Regex not working as expected

xeeton's Avatar

xeeton

08 Sep, 2010 09:16 PM

I'm using the regex matched Message Alerts and it isn't working as expected. My name is "drew" and there is an "andrew" in our office. So, I've concocted this to match only my name:

However this is not working. For now I'm using "(d|D)(y|Y|rew)" which, while works, matches "andrew" which I don't want.

  1. Support Staff 1 Posted by trevor on 08 Sep, 2010 09:24 PM

    trevor's Avatar

    Hey,

    what you want is a case-insensitive, positive match that includes word boundaries:

    (?i)\bdrew\b

    From your regex it looks like you also want to respond to (case insensitive) 'DY' so that would be:

    (?i)\b(drew|dy)\b

    Regards, Trev

Reply to this discussion

Internal reply

Formatting help / Preview (switch to plain text) No formatting (switch to Markdown)

Attaching KB article:

»

Attached Files

You can attach files up to 10MB

If you don't have an account yet, we need to confirm you're human and not a machine trying to post spam.

Keyboard shortcuts

Generic

? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac