-
-
Notifications
You must be signed in to change notification settings - Fork 16
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix automatic delimiters detection #55
Labels
Comments
This comment has been minimized.
This comment has been minimized.
danon
added a commit
that referenced
this issue
Nov 2, 2019
danon
added a commit
that referenced
this issue
Nov 3, 2019
danon
added a commit
that referenced
this issue
Nov 3, 2019
danon
added a commit
that referenced
this issue
Nov 3, 2019
But now problem arises:
|
Basically, to throw an arbitrary string, go Pattern::pcre('/hello?/m')->valid(); To validate T-Regx style patterns, go: pattern('hello?', 'm')->valid();
Pattern::of('hello?', 'm')->valid(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Currently,
pattern()
/Pattern::of()
/new Pattern()
, each "guess" whether a pattern is delimited (with flags) or not.This is ambiguous, for example:
/abc/m
delimited? Of course_abc_m
delimited?pattern()
would say yes,(word),x
delimited?pattern()
would see,(word),
andx
flag.,(word),xF
delimited? suddenly,xF
are not valid flags sopattern()
would see,(word),xF
with no flags.//s
an empty pattern withs
flag? Or//s
pattern?pattern()
would choose the firstSo:
pattern()
/Pattern::of()
will now treat each pattern as undelimited by default. Validation will be performed, whether we have enough delimiters to delimit it properly. If we don't, the other method will have to be used.Pattern::pcre()
, which will only accept a delimited pattern, that is:New method name, perhaps:
Pattern::standard()
- standard pattern for PCRE, not so much for T-RegxPattern::basic()
Pattern::pcre()
- unintuitivePattern::undelimited()
- too longPattern::raw()
- too crudeThe text was updated successfully, but these errors were encountered: