Canonical strings and associated methods

It supports regular expressions String object methods

FF: Firefox, IE: Internet Explorer

method description FF IE
search Retrieving the value of the regular expression to match. 1 4
match Find one or more regular expression matching. 1 4
replace Alternatively substring match the regular expression. 1 4
split String is divided into an array of strings. 1 4

/ *
* Split ()
* may be a string into an array
* resolved according to any letter
* method, a regular expression can be passed as a parameter, so the method will be to split the character string expression The positive
* /

/*

* Search ()
* may contain a search string specified whether the content
* If the search string, then may be returned to the index of the first occurrence, or -1 if the search returns no
* it can accept a regular expression as an argument, then will the expression to check the index based on the positive.
* If it contains the search string abc or aec or ADC
* /

*
* Match ()
* according to a regular expression, a string that will meet the conditions of the contents extracted
* By default our match () will find the contents of the first to meet the requirements we set for the regular expression global expression can retrieve the global
* /

 

 

 

 or

/ *
* Replace ()
* may be replaced with the new content of the string has two parameters designated content
* parameters
* 1. Content replaced
* 2. New Content
* 3. Alternatively only a default
* /

 

Guess you like

Origin www.cnblogs.com/niuyaomin/p/11605525.html