Home  >  Article  >  Backend Development  >  Are regular expressions in java the same as regular expressions in JavaScript? Is it the same as in php etc.?

Are regular expressions in java the same as regular expressions in JavaScript? Is it the same as in php etc.?

WBOY
WBOYOriginal
2016-08-04 09:22:061537browse

It’s so easy for a newbie to learn
I randomly searched on Baidu and found that many languages ​​involve regular expressions, such as java php JavaScript and so on. It feels quite important. I watched some videos myself and was confused by the learning.
Are they similar in general?

Reply content:

It’s so easy for a newbie to learn
I randomly searched on Baidu and found that many languages ​​involve regular expressions, such as java php JavaScript and so on. It feels quite important. I watched some videos and learned a lot.
Are they similar in general?

Basically the rules are the same, but there are differences in usage. After all, the language features are different

There are two different forms. See the summary below, but some features are not supported in different languages.
http://zonxin.github.io/post/2015/08/regular-expression-cheetsheet

The languages ​​you listed all support regular expressions in PCRE format. Another commonly used format is POSIX format, which is supported by older versions of PHP.

Of course, there are subtle differences between the two PCRE schools. You can just learn any one and check the documentation if you encounter any differences. If you are interested, you can read the book "Regular Guide", which summarizes and compares the implementation of regular expressions in different programming languages ​​in detail.

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
Previous article:php pdf file to imageNext article:php pdf file to image