silentrob / superscript-editor

NOT MAINTAINED - A Editor for authoring chatbots with SuperScript
MIT License
27 stars 16 forks source link

Variable length wildcards with zero value not matching #15

Closed mariusursache closed 9 years ago

mariusursache commented 9 years ago

A trigger like hello *~2 will match hello John Doe and hello John but will fail to match hello. Just tested.

silentrob commented 9 years ago

I just noticed I don't have a test that covers the zero use-case and I have no idea how this went so long without being caught.

So

* - zero to infinity tokens *n - exactly n tokens *~n - Should be between zero and n tokens but is probably one to n tokens as per your tests. *(n-m) - range wildcard. This could deprecate the above two, but I would need to test it a little more.

silentrob commented 9 years ago

I just pushed a fix for variable length wildcards. It should work now 0 - n. I will update the editor and push the matching version so you can test it.

silentrob commented 9 years ago

It is in superscript@0.8.7 npm update should pull it in.