I am working in a Java EE project with Java 7 and searching for a solution how to write a regular expression. On the tutorial sites like RegularExpressions.info
, I couldn't find the answer, and I was unfortunately inapt to construct it on a test site
. So, I ask you.
What I need is a regular expression that runs under Java 7 and filters the input such that it returns any set of characters & words that do not
contain the words CONTROL and TRACTION in a case-insensitive
way. How to write it?
Thank you for your help!
Notice: Although this is a regular expression question, I added the topic "Java", as it seems that there are some diversions between what I used under UNIX decades ago & what Java supports. For instance, I had to correct my expressions from the commented code to the uncommented one:
String regularExpression = "(ERROR|";
//regularExpression += "(CONTROL|TRACTION).(CAR|UNIT))";
regularExpression += "(CONTROL|MOTOR).(CAR|UNIT)|(Control|Motor).(car|unit))"