Home >Backend Development >PHP Problem >What is the difference between js regular expression and php regular expression

What is the difference between js regular expression and php regular expression

WBOY
WBOYOriginal
2022-03-02 10:20:592552browse

Difference: 1. PHP regular expressions support "(?

What is the difference between js regular expression and php regular expression

This tutorial operation Environment: Windows 10 system, javascript1.8.5&&PHP7.1 version, Dell G3 computer.

What is the difference between js regular expressions and php regular expressions

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!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn