hubot-plusplus icon indicating copy to clipboard operation
hubot-plusplus copied to clipboard

Cannot erase any "thing" that has -- or ++ included in the string.

Open hpdubs14 opened this issue 8 years ago • 3 comments

You cannot erase a record of the "thing" if it contains contains the any of the points trigger patterns.

If a user enters the command hubot user -------------------------, it will create a new thing record with points.

This command hubot erase user ----------------------- will create another thing with points instead of erasing that record.

hpdubs14 avatar Mar 30 '16 21:03 hpdubs14

Does this work better for the regex by separating out the delimiter matching pattern from the username matching pattern? This wouldn't work if the username included the colon but I'm not sure if that is actually an acceptable format in most cases.

^([\s\w'@.\-]*)[:|\s?].*(\+\+|--|—)(?:\s+(?:for|because|cause|cuz|as)\s+(.+))?

This also manages the cases where someone inputs +++++++++ or -------- for extreme likes/dislikes.

hpdubs14 avatar Apr 16 '16 16:04 hpdubs14

We should allow for the semicolon, because Slack (possibly other plaforms) automatically insert it, so it makes it easier for people if they don't have to worry about removing it.

therealklanni avatar Apr 18 '16 23:04 therealklanni

Feel free to submit a PR! Please make sure to add a test case that covers this scenario.

therealklanni avatar Apr 18 '16 23:04 therealklanni