Is there any way where I can display all characters and strings except a certain set of words or range of numbers, using Java? For example:
Regex:
^(if|else),[0-9]
Input String:
if x <= 7
Output:
Unrecognized Tokens:
x , <=
Since "if
" and 7
are negated, they won't appear.
Can I negate set of strings and range of numbers all in a single regular expression?
Or is there any other way that I can just display the unmatched strings?
Our assignment is to display the recognized tokens, then the unmatched tokens. I've researched and studied regex for three days, but I still can't get my assignment done. Thanks in advance for any help.