Remove any content starting from a and ending at b
Auditormadness9 last edited by
I am trying to regex search like this
(http).*(",), but instead of matching multiple areas that are between an
httpstring and a
",string, it instead selects the ENTIRE area from the first ever occurence of
httpup until the last occurence of
",which is NOT what I want, I instead want it to find all the instances of areas between those two strings.
Any help for this will be gladly appreciated!^^
PeterJones last edited by
.*will try to capture as much as possible, which is why your expression is grabbing from the first http to the last
",. To make it non-greedy, in order to capture the least amount possible (and thus the first
httpto the first
*to be non-greedy.
the ENTIRE area from the first ever occurence of http up until the last occurence of ",
Sounds like it’s matching multiple lines. To stop this, ensure that in Find window, Search mode, “. matches newline” is not checked. This will confine matches to (parts of) each line.
Then, either your orig (greedy) or non-greedy as per Peter’s suggestion, will give the hoped for result.
Alan Kilborn last edited by Alan Kilborn
ensure that in Find window, Search mode, “. matches newline” is not checked. This will confine matches to (parts of) each line.
Careful with a statement such as that, as I can easily write a regular expression that will have multiple lines in a single match even when that checkbox is checked.
It only disallows the
.used in the regex to match line-ending characters; it does nothing to prevent other constructs from matching across line boundaries.
Correct, but other people come along and read this stuff and perhaps would grab onto a statement like “. matches newline…will confine matches to parts of each line”.
And anyway, for all we know, the OP does want to span lines with his matches. Who’s to say, because he (OP) didn’t.
for all we know, the OP does want to span lines with his matches
but instead of matching multiple areas that are between an http string and a "
which sounds to me like he wants the greedy form but acting per line.
It’s inconclusive, unless OP comes back for more help.
We’ve seen it many times.