I want to find if a particular sub-string is not present in a file to exit the output.
For example, let the file have the contents below:
Time|Code 1| Code 2 | Message string
2019-04-03 12:05:29,006|00002| D8456| This is a test
2019-04-03 12:05:29,006|00003| D8457| This is a test
what I want is have the user pass a regex that will return True if there is no match.
For instance: exit if you don't see 00002
, or exit if you don't see the word test
.
update: this will exit on the condition passed. I'm just trying to find the correct syntax for the below case. it could exit if the condition is found, condition is not found, any of the conditions are found. for the most part the syntax of re is pretty self explanatory except the negative match. Thank you!