You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I noticed spatie/regex does not use the PREG_UNMATCHED_AS_NULL flag when it calls preg_match() and preg_match_all(). This results in inconsistent results with unmatched capturing groups.
I have created a pull request which fixes the issue and adds some tests. However, I wanted to verify two things:
Is there a reason the flag is not being used?
I noticed that MatchResult::group() uses isset() to determine whether or not a group exists. If we implement PREG_UNMATCHED_AS_NULL, that will return false for unmatched groups... which makes sense, but is also inconsistent. What is the desired behavior here?
The text was updated successfully, but these errors were encountered:
I noticed
spatie/regex
does not use thePREG_UNMATCHED_AS_NULL
flag when it callspreg_match()
andpreg_match_all()
. This results in inconsistent results with unmatched capturing groups.Demo here.
I have created a pull request which fixes the issue and adds some tests. However, I wanted to verify two things:
MatchResult::group()
usesisset()
to determine whether or not a group exists. If we implementPREG_UNMATCHED_AS_NULL
, that will return false for unmatched groups... which makes sense, but is also inconsistent. What is the desired behavior here?The text was updated successfully, but these errors were encountered: