Hope kind soul can help me with this - I’m trying to get all the lines of a file that don’t match a particular string construct. My input file is from the /etc/passwd file (cut down) and has the following:-
root:x
uatapache:x
u1234:x
lnadmin:x
n567890:x
I can pull all the accounts that start with a ‘u’ or a ‘n’ and are followed by three to eight numerals using:-
((parenthesized part 1 of it) of matches (regex "^([un][0-9]{3,8}):.+$") of (it as lowercase)) of lines of file "passwd.mw"
which returns:
u1234
n567890
What is the correct syntax for the regex to return all the lines that
If you want to use negation in the regex then it would look like this:
Q: exists matches (regex “foo”) of “foo”
A: True
Q: exists matches (regex "
^foo
") of “foo”
A: False
Another way is to have the regex return the name of the user and do something like:
it is not “root” OR it is not “uatapache” OR it is not “lnadmin”
Lastly, if your “is not” set is quite large then – so simplify the syntax – you can create a list and use Relevance’s set logic to see if each user name is in the list.