I'm trying to create a regex that will select an entire line where it contains a matching string.
I can't seem to get it to work.
Any help is greatly appreciated. You can see the test case and what I've tried here:
https://www.regex101.com/r/mT5rZ3/1
Many thanks in advance! :-)
To expand the regex to match a complete line, add ‹ . * › at both ends. The dot-asterisk sequences match zero or more characters within the current line. The asterisk quantifiers are greedy, so they will match as much text as possible.
The ?! n quantifier matches any string that is not followed by a specific string n.
In regular expressions, the period ( . , also called "dot") is the wildcard pattern which matches any single character. Combined with the asterisk operator . * it will match any number of any characters.
This answer solves the question with 463 steps instead of 952 steps. Just ensure a new line at the end of the file.
.*Eventname 2.*\n
https://www.regex101.com/r/mT5rZ3/5
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