Skip to content

Conversation

@SGudbrandsson
Copy link
Contributor

The regular expression (that I wrote) on line 230 was too greedy.
If the U modifier is used then this is ungreedy by default.
The problem is when you have the question mark behind a quantifier then it will inverse that quantifier's greediness.
So it will search for an iframe open tag, then search for the last iframe close tag (rather than the next iframe close tag).
* ORIGINAL REGEXP **
|<iframe\s+.
?</iframe>|siU

By removing the question mark, the whole expression is not greedy by default, resulting in functionality just like you'd want.
* FIXED REGEXP **
|<iframe\s+.
</iframe>|siU

The regular expression (that I wrote) on line 230 was too greedy.
If the U modifier is used then this is ungreedy by default.
The problem is when you have the question mark behind a quantifier then it will inverse that quantifier's greediness.
So it will search for an iframe open tag, then search for the last iframe close tag (rather than the next iframe close tag).
** ORIGINAL REGEXP **
|<iframe\s+.*?</iframe>|siU

By removing the question mark, the whole expression is not greedy by default, resulting in functionality just like you'd want.
** FIXED REGEXP **
|<iframe\s+.*</iframe>|siU
@SGudbrandsson
Copy link
Contributor Author

oh my .. it removed the code I wrote .. oh well..

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant