I have an amount of links like:
- https%3A%2F%2Fwww.facebook.com%2F
- https%3A%2F%2Fwww.facebook.com%2F%3Futm_source
I need to capture the text before (%3F) sequence, and capture the whole line, if this sequence does not appear in the line. I want to do it without if-else condition applied for the whole line.
What am I looking for - is for an a way to apply a ?
quantifier for the whole character sequence, like this: ^(.*)[\%3F]?
P.S. I know, that there is a way to work-around the problem by transforming the HTML-style characters into single ones first (%2F -> "/" and %3F -> "?"
) and than applying ?
quantifier to a single character, but this is not the way I would like to solve the issue.