This chapter doesn't contain
PHP code snippets, because PHP PCRE require delimiters. There is no way to omit them
in Vanilla PHP.
Thanks to automatic delimiters, one can use regular expressions without brain strain and without spending time, choosing a suitable delimiter.
delimited() on any instance of T-Regx
a pattern, as it will be used with PHP PCRE methods.
If the was constructed with
delimited() returns the pattern unchanged.
There are two ways of using patterns with PCRE modifiers:
- // global functionpattern('[A-Z][a-z]+', 'i')->match($subject)->first();// static methodPattern::of('[A-Z][a-z]+', 'i')->match($subject)->first();// prepared patternsPattern::inject('[A-Z]@', [$_GET['name']], 'i')->search($subject)->first();
or use an old-school pattern:PcrePattern::of('/[A-Z][a-z]+/i')->search($subject)->first();
T-Regx has a set of predefined, suitable delimiters (like
%, etc.) and simply uses the first one, that
doesn't occur in your pattern. If you exhaust each of them; if you use every possible, predefined,
suitable delimiter - it will throw
In that case, you simply have to use an explicit delimiter with
If you think another automatic delimiter can be used, please create a github issue.