jQuery.escExpStr()
Categories: Utilities
jQuery.escExpStr( string, [ except ] )Returns: Array
Plugin: jQuery.string
Description: Escape an string for use as regular expression.
-
jQuery.escExpStr( string, [ except ] )
version added: 1.0string A string to escape.
except A string containing characters to except from escaping.
The jQuery.escExpStr()
method escape reserved regular expression characters.
-
Escape all reserved regular expression characters.
Code:
var string = '[A-Z]*[()0-9]+'; $.escExpStr( string );
Results:
\[A-Z\]\*\[\(\)0-9\]\+
-
Escape reserved regular expression characters, excepting []*+.
Code:
var string = '[A-Z]*[()0-9]+'; $.escExpStr( string, '[]*+' );
Results:
[A-Z]*[\(\)0-9]+