Quantcast
Channel: THWACK: Message List
Viewing all articles
Browse latest Browse all 20958

Re: Check many lines at once within Policy Manager?

$
0
0

As it turns out, \n does work, but that only searches down 1 line at a time, doesn't account for characters in front of the strings I'm looking for, and not every config is perfectly identical (some have extra lines mixed in), so I have to be able to skip lines. I ended up making a regex string to account for that:

 

          .*\n(.*\n)*.*


I put this at the start of my list of lines to look for, and in between every entry. It just searches for any number of any character (any string, or nothing) followed by a newline, followed by any number (or zero) of those same things - in between any string I search for, it can run into any number of any random other lines. Then, on the line with the stuff I am searching for, before it, it can have any number of any character.


So if I'm searching for:


     bla

     bleh

     derp


among


herp

bla

bleh

sdfklj

derp


I'd just do:


     .*\n(.*\n)*.*bla.*\n(.*\n)*.*bleh.*\n(.*\n)*.*derp


Anyhoo, it works exactly as I need it to. I may make a more complex regex string in the future, but hey, I'm sure everyone who gets into regex strings does thanks for the help guys.


Viewing all articles
Browse latest Browse all 20958

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>