Difference: 1. PHP regular expressions support "(?
This tutorial operation Environment: Windows 10 system, javascript1.8.5&&PHP7.1 version, Dell G3 computer.
In general, PHP's regular expressions are better than standard javascript It must be powerful.
PHP has two sets of regular libraries, one is the posix compatible library (available in versions before php5.3), and the other is the perl compatible library (the main library)
perl compatible library Supports things that js regular does not support:
1. Supports (?
2. Many preset character classes (:alnum:)
3. Support group identification (?<>
4. Support subgroups with the same name (?|
5. Support independent subgroups (?>
6. Support conditional subgroups (?()
7. Support recursive subgroups (?R)
8. Support local encoding, js only supports unicode
9. More correctors
10, etc. are rich in details.
In short, the js regular library appears to be just a simple basic library in front of the php regular library.
Related recommendations: javascript learning tutorial, PHP video tutorial
The above is the detailed content of What is the difference between js regular expression and php regular expression. For more information, please follow other related articles on the PHP Chinese website!