Reputation: 3184
How can I use regex to skip the lines with the text added or deleted and match text after the first 12 characters? For example,
1234567890ABTest
ABC4567890ABTestadded
ABC4567890ABTest2
Line 1 would match Test. Line 2 would not match. Line 3 would match Test2. So far, I have
.*(?<!added)(?<!deleted)$
Upvotes: 3
Views: 25546
Reputation: 67998
^.{12}\KTest(?!(?:added|deleted)\b).*$
You can use \K
to skip first 12
characters.See demo.
https://regex101.com/r/fM9lY3/25
Upvotes: 10
Reputation: 8783
I am using Notepad++ v5.7
Consider removing everything with the following patterns: ^............
, .+added$
and .+deleted$
Everything else is the expected result.
Don't forget to replace in Regular Expression
mode.
Upvotes: 0
Reputation: 3731
How about this?
^.{12}(.*)(?<!added)(?<!deleted)$
pattern{X}
matches pattern
repeated X
times.
pattern{X,Y}
matches pattern
repeated X
to Y
times.
pattern{X,}
matches pattern
at least X
.
pattern{,Y}
matches pattern
up to Y
times.
Upvotes: 1