You have to use a negative lookahead assertion.
(?!^ABC$)
You could for example use the following.
(?!^ABC$)(^.*$)
If this does not work in your editor, try this. It is tested to work in ruby and javascript:
^((?!ABC).)*$
More Related Contents:
- Regular expression to match a line that doesn’t contain a word
- Regular expression for a string containing one word but not another
- How to negate the whole regex?
- Regular expression that doesn’t contain certain string [duplicate]
- Regex: match pattern as long as it’s not in the beginning
- Regex – Does not contain certain Characters
- How can I match a pattern as long as it’s not at the beginning with regex?
- Negate characters in Regular Expression [closed]
- Regex to get the words after matching string [duplicate]
- Regex: Matching by exclusion, without look-ahead – is it possible?
- Unix grep regex containing ‘x’ but not containing ‘y’
- Regular Expression to exclude set of Keywords
- How do I turn any regex into an complement of itself without complex hand editing?
- Phone number regular expressions exact format
- How to match numbers between X and Y with regexp?
- Does a dot have to be escaped in a character class (square brackets) of a regular expression?
- What’s the regular expression that matches a square bracket?
- How does the regular expression ‘(?
- Regex for alphanumeric, but at least one letter
- regex to match word boundary beginning with special characters
- Does the ‘o’ modifier for Perl regular expressions still provide any benefit?
- What regular expression can never match?
- Regular Expression Validation For Indian Phone Number and Mobile number
- How can I parse quoted CSV in Perl with a regex?
- htaccess force https and redirect www to non-www, but no other subdomains
- Checking for diacritics with a regular expression
- Is there any way to put malicious code into a regular expression?
- Replace all whitespace with a line break/paragraph mark to make a word list
- Why do regex engines allow / automatically attempt matching at the end of the input string?
- Apache mod_rewrite REDIRECT_STATUS condition causing directory listing