badLlama121 / discordBot

discordBot testing area
0 stars 3 forks source link

Search strings containing '+' behave oddly #17

Closed bran-solo closed 1 year ago

bran-solo commented 1 year ago

Repro steps:

  1. Say 'test+poop'
  2. Do a '!s +/and'

Expected: Output of 'testandpoop'

Actual: Bot doesn't respond

Probably something weird with how we're using regexes.

bran-solo commented 1 year ago

Have also seen weird stuff with strings containing question marks. Let me know if you want separate issue.

bran-solo commented 1 year ago

Hm seeing another one where www.google.com with '!s google/poop' outputs 'http://www.%2A%2Apoop%2A%2A.com/'.

Guessing if we want to keep using regexp in this way we need to escape the input string.

bran-solo commented 1 year ago

Also fucks up search queries containing '$'

zippy1981 commented 1 year ago

literally just escapt the + like !s love\+/hare- and it will work. I think its funny that bejean wil use a real regex with backticks.