Bluefissure / Inviter

11 stars 3 forks source link

Syntax for patterns #8

Closed sauronshotdogs closed 2 years ago

sauronshotdogs commented 2 years ago

I want to add several phrases for it to pick up. What is the syntax for separating them?

Bluefissure commented 2 years ago

Regex OR: (lfg|inv)

sauronshotdogs commented 2 years ago

Thanks for the quick answer. By Regex, I know that's an option, but I don't know what it means.

Is it case sensitive btw?

Bluefissure commented 2 years ago

Case is ignored by default: https://github.com/Bluefissure/Inviter/blob/main/Inviter/Inviter.cs#L333

BTW there's a good online tool for testing the regex: https://regex101.com/

sauronshotdogs commented 2 years ago

Still not quite sure on regex, but got it working. Thanks!

sauronshotdogs commented 2 years ago

Woops, turns out it didn't work.

lfg|inv|invite|fate|inv please|invite please I use these, but it won't invite people who type that in any of the channels

sauronshotdogs commented 2 years ago

image

Bluefissure commented 2 years ago

It looks good on the online tester, can you provide the text players were saying that were not matched? http://regexstorm.net/tester?p=lfg%7cinv%7cinvite%7cfate%7cinv+please%7cinvite+please&i=inv+please%0d%0alfg+fate%0d%0ainvite+plz

sauronshotdogs commented 2 years ago

Turns out I had forgotten to enable it. Sorry about that.

Is it correctly understood that I should put my pattern into the regex tester to see if they're valid arguments?

Bluefissure commented 2 years ago

Turns out I had forgotten to enable it. Sorry about that.

Is it correctly understood that I should put my pattern into the regex tester to see if they're valid arguments?

You can use regex 101 to test it, but it's not necessary if you are sure that the pattern is correct.