Text Mate 2 – Regex Searching
Some note for myself to help with searching log file – ill update this as i go
Ensure Regular Expression is ticked
to search for 2 string on the same line i use
String1(.*)String2
Where (.*) can contain anything
or
(?<=String1)(.*)(?=String2)
this highlights the text between the 2 strings
search for everything than contains 2 strings, and between these 2 strings it doesn’t contain string3
((?<=String1)(.*)(?=String2))(?!.*String3*)
search for a line that contains X but doesn’t contain Y ( I find this more reliable )
(?<=XXXX)((?!YYYY).)*$
search for a line that contains X but doesn’t contain Y & Z ( I find this more reliable )
(?<=XXXX)((?!YYYY|ZZZZ).)*$
search for everything than contains 2 strings, and between these 2 strings it doesn’t contain string3 & string4
((?<=String1)(.*)(?=String2))((?!.*String3*)(?!.*String4*))
or to search till the end of the line
(?<=String1)(?!.*String2)(?!.*String3)
Starting from the start of the line, ignore all line that contain “XXXX”, but contain the words YYYY and ZZZZ
NOTE: The .* before the words, this mean’s they can come in any order.
^(?!.*XXXX)(?=.*YYYY).*(?=.*ZZZZ)
find string by ignoring the number
E.G
“This is line number 12 in the story”
This is line number (\d+) in the story