There are two ways of instantiating a pattern for T-Regx. Each of them accepts an undelimited pattern as the first argument and optional flags as the second argument.
We have 4 entry points to user T-Regx:
- Standard functions -
pattern()to use undelimited patterns
- Compatibility legacy -
Pattern::pcre()to use vanilla patterns
- Prepared patterns -
Pattern::bind()to safely use user data in patterns
Class method style:
Global function style:
Notice, that these patterns are not be delimited. Smart T-Regx will conveniently add them for you, if you
pattern(). You can add flags to your regular expression by passing a second argument.
To learn more, go to Automatic Delimiters.
Of course, you can still use delimited patterns with flags, with
Pattern::pcre(). Both versions are equal with each other.
To safely handle unsafe date or user input, see Prepared Patterns.