Skip to main content

Command Palette

Search for a command to run...

Regular Expression

Published
2 min readView as Markdown
Regular Expression
S

A passionate Full Stack Software Developer 🚀 having an experience of building Web applications with JavaScript and some other cool libraries and frameworks.

A regular expression is a sequence of characters that forms a search pattern. When you search for data in a text, you can use this search pattern to describe what you are searching for. A regular expression can be a single character or a more complicated pattern.

Regular Expression Modifiers

Modifiers can be used to perform case-insensitive more global searches:

ModifierDescription
iPerform case-insensitive matching
gPerform a global match (find all matches rather than stopping after the first match)
mPerform multiline matching

Regular Expression Patterns

Brackets are used to find a range of characters:

ExpressionDescription
[abc]Find any of the characters between the brackets
[0-9]Find any of the digits between the brackets
(xy)Find any of the alternatives separated with

Metacharacters are characters with a special meaning:

MetacharacterDescription
\dFind a digit
\sFind a whitespace character
\bFind a match at the beginning of a word like this: \bWORD, or at the end of a word like this: WORD\b
\uxxxxFind the Unicode character specified by the hexadecimal number xxxx

Quantifiers define quantities:

QuantifierDescription
n+Matches any string that contains at least one n
n*Matches any string that contains zero or more occurrences of n
n?Matches any string that contains zero or one occurrences of n

More from this blog

Shubham's blog

66 posts