Take this regular expression:
/^[^abc]/. This will match any single character at the beginning of a string, except a, b, or c.
If you add a
* after it –
/^[^abc]*/ – the regular expression will continue to add each subsequent character to the result, until it meets either an
For example, with the source string
"qwerty qwerty whatever abc hello", the expression will match up to
"qwerty qwerty wh".
But what if I wanted the matching string to be
"qwerty qwerty whatever "
…In other words, how can I match everything up to (but not including) the exact sequence