I want to use reg exp to search for, say, a valid IP address from a list of random text excluding those IP addresses of the form 192.168.*.*, 127.*.*.*, 10.*.*.*. Is there any way to use reg expression to specify a non matching pattern? For example, [^192] means a SINGLE character not equals to either 1, 9 or 2. But instead, i want to specify a string of 3 characters not equal to "192". Regular expression does not seem to allow this. Am I right?
As Rob already mentioned: that will not work. Even the grouping inside a character class does not work. Your regex, [^(192)], will match any character other than '(', '1', '9', '2' or ')'. As you can see, the '(' and ')' are just matched as normal characters: only outside a character class they're used to group characters.