Javascript
var patt1=new RegExp ("Hello", "G"); or new RegExp (/^\d+\w+\d+$/); string or pattern form
Patt1.test (str) is used to detect a string or a fixed expression that returns True or false;
Patt1.exec (STR) returns the detected string;
Patt1.compile ("E") is used to change the content of the search;
There are also regular expressions that support string retrieval
Str.search (/pattern/i or string) search does not have a global schema, which returns the position of the first detected string or-1;
Str.match (/pattern/gi or string ); Returns the detected string;
Str.replace (/pattern/or string, replacement); Returns the expression after being replaced;
Str.split (/pattern/or string (this part is a delimiter), Howmany (used to control the number of array elements))
Php
(0 or 1) int preg_match (PATTERN,STR); retrieve only once
(0 or full number of matches) int Preg_match_all ()
Preg_replace (PATTERN,REPLACEMENT,STR)
Regular expressions in JavaScript and PHP