Compiles a regular expression into an internal format for faster execution.
SyntaxrgExp.compile( pattern , [ flags ] )
g
(global search for all occurrences of the pattern), i
(ignore case), m
(multiline search), u
(Unicode), y
(sticky matching),
The following example illustrates the use of the compile method:
function CompileDemo(){
var rs;
var s = "AaBbCcDdEeFfGgHhIiJjKkLlMmNnOoPp"
var r = new RegExp("[A-Z]", "g");
var a1 = s.match(r)
var a2 = s.match(r)
return(a1 + "\n" + a2);
}
Remarks
The compile method converts pattern into an internal format for faster execution. This allows for more efficient use of regular expressions in loops, for example. A compiled regular expression speeds things up when reusing the same expression repeatedly. No advantage is gained, however, if the regular expression changes.
AttributionsMicrosoft Developer Network: Article
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4