Animations

API

Arrays

Async

Basics

Challenges

Classes

Console

Dates

Debugging

DOM Elements

DOM Methods

DOM Navigation

DOM Properties

Event Listeners

Flow Control

Forms

Functions

Global Functions

JSON

Keywords

Libraries (3rd party)

Math

Modules

Objects

Snippets

String

Types

Widgets

Window Object

JavaScript - RegExPatterns

Brackets are used to find a range of characters.

[abc]
Find any character between the brackets
[a-z]
Find within this range of characters
[^abc]
Find any character NOT between the brackets
[0-9]
Find any digit between the brackets
[^0-9]
Find any digit NOT between the brackets
(x|y)
Find any of the alternatives specified

MetaCharacters are characters with a special meaning.

*
Find any number of characters within the range
{x}
indicates how consecutive characters it should search within
\d
Find a digit
\s
Find a whitespace character
\b
Find a match at the beginning or at the end of a word
\uxxxx
Find the Unicode character specified by the hexadecimal number xxxx

Modifiers are characters with a special meaning.

*
Find any number of characters within the range
\i
Perform case-insensitive matching
\g
Perform a global match (find all matches rather than stopping after the first match)
\m
Perform multiline matching

Quantifiers define quantities.

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

// Example 1 - finds all occurrences of 'e'. Use 'i' for showing only first occurrence.
var str = "Is anyone out there?";
var patt1 = /[e]/g;
var results = str.match(patt1);
$("#demo1").html(results);

// Example 2
var str2 = "Is anyone out there?" - finds all occurrences of 'anyone';
var patt2 = /anyone/g;
var results2 = str2.match(patt2);
$("#demo2").html(results2);

// Example 3 - finds all matches for 'is' (even partials).
var str3 = "Do you know if this is all there is?";
var patt3 = /[is]/gi;
var results3 = str3.match(patt3);
$("#demo3").html(results3);

// Example 4 - finds '1234'
var str4 = "123456789";
var patt4 = /[1-4]/g;
var results4 = str4.match(patt4);
$("#demo4").html(results4);

https://www.w3schools.com/js/js_regexp.asp

http://buildregex.com/

https://www.regexbuddy.com/create.html