Reputation: 47
I want to take strings that start with syslog but but not syslog exactly
e.g:
So far, I have this to exclude syslog exactly:
(?!^syslog$)(^.*$)
Upvotes: 1
Views: 232
Reputation: 18611
Use
^syslog.+
See proof.
EXPLANATION
--------------------------------------------------------------------------------
^ the beginning of the string
--------------------------------------------------------------------------------
syslog 'syslog'
--------------------------------------------------------------------------------
.+ any character except \n (1 or more times
(matching the most amount possible))
Upvotes: 1
Reputation: 163207
You can match a non whitespace char \S
after matching syslog, and then match the rest of the line without using a lookahead.
^syslog\S.*$
Upvotes: 1