This chapter doesn't contain
PHPcode 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 coming up with a suitable delimiter.
Automatic delimiters work perfectly fine, regardless of whether you passed a delimited pattern or not.
The code snippets above are equal.
Is pattern delimited
You can check whether a pattern is delimited with
To change undelimited pattern into a delimited one - use
How does T-Regx decide whether a pattern is already delimited, or whether it's not and needs to be delimited again?
The rule is simple.
If a pattern can be thought of as delimited - T-Regx assumes it's delimited.
There are two ways of passing flags:
or use a regular delimited pattern with a flag:
I want to break it
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 -
T-Regx will throw
In that case, you simply have to use an explicit, regular delimiter and automatic delimiter won't be used.
If you think another automatic delimiter can be used, please create a github issue.