Can anybody explain what the correct Java regex is to match all lines that don't start with timestamp [0-9]{4}-[0-9]{2}-[0-9]{2}
?
I am trying to use ^(^[0-9]{4}-[0-9]{2}-[0-9]{2})
but it doesn't work.
Can anybody explain what the correct Java regex is to match all lines that don't start with timestamp [0-9]{4}-[0-9]{2}-[0-9]{2}
?
I am trying to use ^(^[0-9]{4}-[0-9]{2}-[0-9]{2})
but it doesn't work.
Your ^(^[0-9]{4}-[0-9]{2}-[0-9]{2})
pattern matches a string starting with the pattern you defined (the ^
here just matches the start of a string).
In Go lang, the regex engine does not support lookarounds, and thus it is difficult to create a readable regex that would do the required job.
I suggest you remove all lines that match your pattern
(?m)\s*^[0-9]{4}-[0-9]{2}-[0-9]{2}.*
(see demo) and then split the result with line breaks to get the lines that did not match the pattern.