
illustrate
1. Starting from PHP7.3, PCRE2 will be used as the new regular engine.
2. Existing regular expressions need to be migrated to comply with PCRE2 rules. These rules are more intrusive than before.
characteristic
Relative backreference g{+2} (equivalent to existing g{-2})
PCRE2 version check (?(VERSION>=x)...)
(*NOTEMPTY) and (*NOTEMPTY_ATSTART) tell the engine not to return empty matches
(*NO_JIT) Disable JIT optimization
(*LIMIT_HEAP=d) limits the heap size to d KB
(*LIMIT_DEPTH=d) Set the backtracking depth limit to d
(*LIMIT_MATCH=d) Set the match limit to d
Example
preg_match('/[w-.]+/', '');The above is the use of PCRE2 in php, I hope it will be helpful to everyone.