RegExp
Last updated
Was this helpful?
Last updated
Was this helpful?
The RegExp
object in JavaScript provides powerful tools for pattern matching and text processing. It allows developers to define patterns for searching and manipulating strings, supporting modifiers such as global searches, case-insensitivity, and multiline matching. Key properties include the pattern source, flags indicating active modifiers, and the index position for the next match.
Core functionality includes the exec()
method, which searches for a pattern and returns the matched value while keeping track of the match position, and the test()
method, which checks if a pattern exists in a string, returning a boolean result.
For more information see: .
Specifies if the "g" modifier is set.
Specifies if the "i" modifier is set.
An integer specifying the index at which to start the next match.
Specifies if the "m" modifier is set.
The text used for pattern matching.
Search a string for a specified value.
Search a string for a specified value.
Specifies if the "g" modifier is set.
Sample
Specifies if the "i" modifier is set.
Sample
An integer specifying the index at which to start the next match.
Sample
Specifies if the "m" modifier is set.
Sample
The text used for pattern matching.
Sample
Search a string for a specified value. Returns the found value and remembers the position.
Parameters
Sample
Search a string for a specified value. Returns true or false.
Parameters
Sample
Type
Type
Type
Type
Type
string ;
Returns: A String representing the found value.
string ;
Returns: true if a match was found in the string. false otherwise.