I fairly new to regular expressions and need some help. I need to filter some lines using regex in Perl. I am going to pass the regex to another function so it needs to be done in a single line.
I want to select only lines that contain "too long"
and that don't begin with "SKIPPING"
Here are my test strings:
SKIPPING this bond since maturity too long
TKIPPING this bond since maturity too long
SLAPPING this bond since maturity too long
Hello this maturity too long
this is too long
hello there
The regex rule should match the following on 'too long":
SKIPPING this bond since maturity too long
SLAPPING this bond since maturity too long
Hello this maturity too long
this is too long
and it should skip:
"hello there" because it doesn't contain 'too long'
"SKIPPING this bond since maturity too long" because it containst 'SKIPPING'
/^(?!SKIPPING).*too long/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With