Support ranged word wildcard matching
Opened this issue · 0 comments
kirsle commented
Support an extended syntax for wildcard characters in triggers to enable them to match ranged numbers of words, for example one could match "between 2 and 4 words" or one could be "no more than 3 words" and so on.
Syntax example:
// match 2 words (first and last name)
+ my name is *2
- Nice to meet you <formal>.
Types of ranged words to support:
*
= match one or more words (current behavior; no change) -- regexp equivalent(.+?)
*5
= match exactly five words -- regexp<word>{5}
where<word>
is like(?:\b\w+\b[\s\r\n]*)
*~5
= match one to five words -- regexp<word>{1,5}
*2~5
= match two to five words -- regexp<word>{2,5}
*2~
= match at least two words -- regexp<word>{2,}