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)
(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.
As you can see, it gets messy fast
Thanks
@gbj_tester started
London Fixed Gear and Single-Speed is a community of predominantly fixed gear and single-speed cyclists in and around London, UK.
This site is supported almost exclusively by donations. Please consider donating a small amount regularly.
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:
(?: )
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.