Delimited patterns
Delimited pattern#
Method Pattern.delimited() returns regular expression as string,
representing the pattern in format compatible with with PHP PCRE methods.
PCRE-style patterns#
If the Pattern was constructed with PcrePattern::of(), method delimited() returns the pattern unchanged.
However, certain regular expressions will be modified to allow safe execution. For example, pattern /\c\/
fails matching in vanilla PHP, so such pattern is delimited in other ways, to ensure proper execution.
Modifiers#
There are two ways of using patterns with PCRE modifiers:
Either pass a second argument to
pattern()/Pattern::of():or use an old-school pattern: