Phrase matching breaks on single quote

Issue #8 new
Zargawi created an issue

Phrase matching only matches two quotes, the negated set regex isn't working.

Ex: "thing's thing's thing"++ only matches the last two [\'"] and returns: "s thing's karma has increased"

Potential solution: change phrase matching from (?:(["\'])([^\'"]+)[\'"]) to (?:(["'])(?:.)*?\1)

This should match any single quotes inside double quotes, and any double quotes inside single quotes.

I'm not smart enough to figure out how to match same type of quotes in javascript (without lookbehinds), but this is better behavior than now (broken).

Comments (2)

  1. Robert Bergman Account Deactivated

    Thanks. Your proposed solution is actually how I originally had developed this add-on. Unfortunately, the HipChat add-on API changed the regexes it accepts to not allow back references, so I had to weaken the regex to the form that we have now.

    It's possible that this could still be fixed by building the regex up to allow an OR matcher, allowing either '...' or "...", explicitly. With that in mind, I'll leave this open for now and try to make that work next time I refactor the karma regex (which is needed for some other open issues at this time).

  2. Zargawi reporter

    Hmmm... bummer.

    Just thought I'd share that our entire organization is on the Karma wagon now :) thank you for making this!

  3. Log in to comment