Get the App
SLTechnology News&Howtos  ›  Development  › 

What are the modifiers of JavaScript regular expressions

Shulou Source: shulou.com Published: 2022-06-01 10:31:01 11月12日 Update

This article focuses on "what are the modifiers of JavaScript regular expressions". Interested friends may wish to have a look at them. The method introduced in this paper is simple, fast and practical. Let's let the editor take you to learn what are the modifiers of JavaScript regular expressions.

JavaScript regular expression modifier

Modifiers can be used for more global searches that are case-insensitive:

Modifier description

I perform case-insensitive matching.

G performs a global match (looking for all matches instead of stopping after the first match is found).

M performs multi-line matching.

Regular expression pattern

Parentheses are used to find a range of strings:

Expression description

[abc] looks for any character between square brackets.

[0-9] look for any number from 0 to 9.

(X | y) find any options separated by |.

Metacharacters (Metacharacter) are characters with a special meaning:

Metacharacter description

\ d look for numbers.

\ s look for white space characters.

\ b match word boundaries.

\ uxxxx looks for Unicode characters specified in the hexadecimal number xxxx.

Quantifiers defines quantifiers:

Quantifier description

N + matches any string that contains at least one n.

N * matches any string that contains zero or more ns.

N? Matches any string that contains zero or one n.

At this point, I believe you have a deeper understanding of "what are the modifiers of JavaScript regular expressions?" you might as well do it in practice. Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!

Tags: Characters expressions regular string metacharacters global content numbers quantifiers learning practical deeper special between interest hexadecimal words meaning multiple size Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Xiaomi Huawei macOS MySQL vpn