You are reading a single comment by @gbj_tester and its replies. Click here to read the full conversation.
  • If you don't actually need a regular expression, eg you're using PCRE or similar, then you want a negative lookahead:
    (beatrix(?!ie)|(?!bea)trixie)

    It is possible to do it with standard regular expressions (since every regular language can be negated), but it's much more painful.

    Edit: for completeness, here's what that would look like:

    (?:(?:(?:[^b]|b(?:b|eb)*?(?:[^be]|e[^ab]))*?(?:b(?:b|eb)*e?)??(trixie))|(?:(beatrix)(?:(?:[^i]|i+[^ei])*?i*?)))
    

    (?: ) is a non-capturing group, *? and ?? are lazy (rather than greedy) matching, negations constructed using this tool http://www.formauri.es/personal/pgimeno/misc/non-match-regex/

    As you can see, it gets messy fast.

About

Avatar for gbj_tester @gbj_tester started