Computer >> Computer tutorials >  >> Programming >> Javascript

How can I simplify the usage of Regular Expressions with JavaScript?


Use Modifiers to simplify the usage of Regular Expressions with JavaScript. It helps you to search in multiple lines, perform a case-insensitive search, etc.

Example

The following are the methods −

Sr.No
Modifier & Description
1I
Perform case-insensitive matching.
2M
Specifies that if the string has newline or carriage return characters, the ^ and $ operators will now match against a newline boundary, instead of a string boundary
3G
Performs a global match that is, find all matches rather than stopping after the first match.