I want to take strings that start with syslog but but not syslog exactly
e.g:
- syslog = not match
- syslog.1 = match
- random = not match
So far, I have this to exclude syslog exactly:
(?!^syslog$)(^.*$)
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$)(^.*$)
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.*$
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))