-1

How can I make a regex that will select lines that does not follow a pattern. So I have log file that has the following pattern:

[12.12.2022 22:26:25] <01> Info Unregistering TCP client channel [bstcp] [12.12.2022 22:26:25] <01> Info Channel successfully unregistered

but everytime a new log starts it will also log the following:

=================================================================== Starting new log Process: [64 bit], PID: [5028], SessionId: [0]

How can I select only the ones with the patter:

[date] loglevel message

Thanks

I was trying things on https://regex101.com/ but I was not successful.

I am expecting to select all the lines that has the following pattern:

[date] loglevel message

0

1 Answer 1

1

If you just want lines starting with the date/timestamp, you should be able to just use the following regex pattern in multiline mode:

^\[\d{2}\.\d{2}\.\d{4} \d{2}:\d{2}:\d{2}\].*$

The date pattern is fairly distinct and should only match the lines you want.

Demo

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.