2024-02-04T06:12:47.137Z
nova-2
2-general-nova
2024-01-09.29447
30089e05-99d1-4376-b32e-c263170674af
90bd7d95-3c85-43a5-a4f3-dc74d98de342
d65f827266564fb17898399f4030cf13a22b75d2df1a420d6711dae5cfdf58b1
67875a7f-c9c4-48a0-aa55-5bdb8a91c34a
deprecated
Regular expressions, a k a reg x or reg x if you prefer, is a tool for finding patterns within a string.
Its 2 most common use cases include the validation of user generated input and to search through a large body of text, such as a find and replace operation in a document.
It's notoriously difficult to learn because its syntax ends up looking like a meaningless pile of But once you learn it, you'll have a very powerful and universal way to parse text in any programming language.
For example, In JavaScript, you can use match to find all the matching patterns within a string.
Search to test for a single match.
And replace to replace the matching patterns.
But before you can put these to use, you need to know how to write a regular expression.
In JS, we can do that with the literal syntax by starting with 2 forward slashes.
Between these characters is where we define our search pattern.
You can find an exact match by simply typing the string you're looking for.
By default, it will only find the first match.
However, you can change this behavior by adding a flag to the right side of the closing slash.
The g flag means global, and we'll look for multiple matches in the text.
And you can add additional flags here as well.
Now, in order to create a more complex search pattern, you can bind a handful of special characters within your expression.
Use a vertical bar as a logical or to match one string or the other.
You can group your logic using parentheses.
This isolates your code from the rest of the pattern, so you can capture substrings.
Generics.
You can use quantifiers to control how often the preceding pattern is allowed to occur.
A question mark allows a pattern to occur 0 or 1 times.
An asterisk allows a pattern to occur 0 or multiple times.
And a plus sign means 1 or more times.
Or you can control this behavior explicitly using braces.
Setting an exact number of occurrences or a min max value.
You can use a backslash in your pattern to escape any of these special characters.
Or a backslash might refer to a character class, like d for any digit, or w for any word character.
Make these a capital letter, and now you have anything that's not a digit or not a word character.
You can use brackets to define your own custom character sets, like a range of all capital letters from a to z, or a custom character set that you create.
And you can negate the set by adding a caret in front of it.
But Like I said at the beginning, regex is not an easy thing to learn.
Check out my cheat sheet on FireShip IO for a bunch of common examples that I find useful.
And use awesome tools like regexer.com to interactively test and, more importantly, understand exactly what your code is doing.
This has been Regular Expressions in 100 seconds.
Hit the like button if you want to see more videos like this.
Thanks for watching, and I will see you in the next one.

Speaker 0: Regular expressions, a k a reg x or reg x if you prefer, is a tool for finding patterns within a string. Its 2 most common use cases include the validation of user generated input and to search through a large body of text, such as a find and replace operation in a document. It's notoriously difficult to learn because its syntax ends up looking like a meaningless pile of But once you learn it, you'll have a very powerful and universal way to parse text in any programming language. For example, In JavaScript, you can use match to find all the matching patterns within a string. Search to test for a single match.

And replace to replace the matching patterns. But before you can put these to use, you need to know how to write a regular expression. In JS, we can do that with the literal syntax by starting with 2 forward slashes. Between these characters is where we define our search pattern. You can find an exact match by simply typing the string you're looking for.

By default, it will only find the first match. However, you can change this behavior by adding a flag to the right side of the closing slash. The g flag means global, and we'll look for multiple matches in the text. And you can add additional flags here as well. Now, in order to create a more complex search pattern, you can bind a handful of special characters within your expression.

Use a vertical bar as a logical or to match one string or the other. You can group your logic using parentheses. This isolates your code from the rest of the pattern, so you can capture substrings. Generics. You can use quantifiers to control how often the preceding pattern is allowed to occur.

A question mark allows a pattern to occur 0 or 1 times. An asterisk allows a pattern to occur 0 or multiple times. And a plus sign means 1 or more times. Or you can control this behavior explicitly using braces. Setting an exact number of occurrences or a min max value.

You can use a backslash in your pattern to escape any of these special characters. Or a backslash might refer to a character class, like d for any digit, or w for any word character. Make these a capital letter, and now you have anything that's not a digit or not a word character. You can use brackets to define your own custom character sets, like a range of all capital letters from a to z, or a custom character set that you create. And you can negate the set by adding a caret in front of it.

But Like I said at the beginning, regex is not an easy thing to learn. Check out my cheat sheet on FireShip IO for a bunch of common examples that I find useful. And use awesome tools like regexer.com to interactively test and, more importantly, understand exactly what your code is doing. This has been Regular Expressions in 100 seconds. Hit the like button if you want to see more videos like this.

Thanks for watching, and I will see you in the next one.
Regular expressions, a k a reg x or reg x if you prefer, is a tool for finding patterns within a string. Its 2 most common use cases include the validation of user generated input and to search through a large body of text, such as a find and replace operation in a document. It's notoriously difficult to learn because its syntax ends up looking like a meaningless pile of But once you learn it, you'll have a very powerful and universal way to parse text in any programming language. For example, In JavaScript, you can use match to find all the matching patterns within a string. Search to test for a single match. And replace to replace the matching patterns. But before you can put these to use, you need to know how to write a regular expression. In JS, we can do that with the literal syntax by starting with 2 forward slashes. Between these characters is where we define our search pattern. You can find an exact match by simply typing the string you're looking for. By default, it will only find the first match. However, you can change this behavior by adding a flag to the right side of the closing slash. The g flag means global, and we'll look for multiple matches in the text. And you can add additional flags here as well. Now, in order to create a more complex search pattern, you can bind a handful of special characters within your expression.
Use a vertical bar as a logical or to match one string or the other. You can group your logic using parentheses. This isolates your code from the rest of the pattern, so you can capture substrings. Generics. You can use quantifiers to control how often the preceding pattern is allowed to occur.
logic
A question mark allows a pattern to occur 0 or 1 times. An asterisk allows a pattern to occur 0 or multiple times. And a plus sign means 1 or more times. Or you can control this behavior explicitly using braces. Setting an exact number of occurrences or a min max value. You can use a backslash in your pattern to escape any of these special characters. Or a backslash might refer to a character class, like d for any digit, or w for any word character. Make these a capital letter, and now you have anything that's not a digit or not a word character. You can use brackets to define your own custom character sets, like a range of all capital letters from a to z, or a custom character set that you create. And you can negate the set by adding a caret in front of it. But Like I said at the beginning, regex is not an easy thing to learn. Check out my cheat sheet on FireShip IO for a bunch of common examples that I find useful. And use awesome tools like regexer.com to interactively test and, more importantly, understand exactly what your code is doing. This has been Regular Expressions in 100 seconds. Hit the like button if you want to see more videos like this. Thanks for watching, and I will see you in the next one.
Regular expressions, a k a reg x or reg x if you prefer, is a tool for finding patterns within a string. Its 2 most common use cases include the validation of user generated input and to search through a large body of text, such as a find and replace operation in a document. It's notoriously difficult to learn because its syntax ends up looking like a meaningless pile of But once you learn it, you'll have a very powerful and universal way to parse text in any programming language. For example, In JavaScript, you can use match to find all the matching patterns within a string. Search to test for a single match. And replace to replace the matching patterns. But before you can put these to use, you need to know how to write a regular expression. In JS, we can do that with the literal syntax by starting with 2 forward slashes. Between these characters is where we define our search pattern. You can find an exact match by simply typing the string you're looking for. By default, it will only find the first match. However, you can change this behavior by adding a flag to the right side of the closing slash. The g flag means global, and we'll look for multiple matches in the text. And you can add additional flags here as well. Now, in order to create a more complex search pattern, you can bind a handful of special characters within your expression. Use a vertical bar as a logical or to match one string or the other. You can group your logic using parentheses. This isolates your code from the rest of the pattern, so you can capture substrings. Generics. You can use quantifiers to control how often the preceding pattern is allowed to occur. A question mark allows a pattern to occur 0 or 1 times. An asterisk allows a pattern to occur 0 or multiple times. And a plus sign means 1 or more times. Or you can control this behavior explicitly using braces. Setting an exact number of occurrences or a min max value. You can use a backslash in your pattern to escape any of these special characters. Or a backslash might refer to a character class, like d for any digit, or w for any word character. Make these a capital letter, and now you have anything that's not a digit or not a word character. You can use brackets to define your own custom character sets, like a range of all capital letters from a to z, or a custom character set that you create. And you can negate the set by adding a caret in front of it. But Like I said at the beginning, regex is not an easy thing to learn. Check out my cheat sheet on FireShip IO for a bunch of common examples that I find useful. And use awesome tools like regexer.com to interactively test and, more importantly, understand exactly what your code is doing. This has been Regular Expressions in 100 seconds. Hit the like button if you want to see more videos like this. Thanks for watching, and I will see you in the next one.
Regular
regular
expressions,
expressions
a
a
k
k
a
a
reg
reg
x
x
or
or
reg
reg
x
x
if
if
you
you
prefer,
prefer
is
is
a
a
tool
tool
for
for
finding
finding
patterns
patterns
within
within
a
a
string.
string
Its
its
2
2
most
most
common
common
use
use
cases
cases
include
include
the
the
validation
validation
of
of
user
user
generated
generated
input
input
and
and
to
to
search
search
through
through
a
a
large
large
body
body
of
of
text,
text
such
such
as
as
a
a
find
find
and
and
replace
replace
operation
operation
in
in
a
a
document.
document
It's
it's
notoriously
notoriously
difficult
difficult
to
to
learn
learn
because
because
its
its
syntax
syntax
ends
ends
up
up
looking
looking
like
like
a
a
meaningless
meaningless
pile
pile
of
of
But
but
once
once
you
you
learn
learn
it,
it
you'll
you'll
have
have
a
a
very
very
powerful
powerful
and
and
universal
universal
way
way
to
to
parse
parse
text
text
in
in
any
any
programming
programming
language.
language
For
for
example,
example
In
in
JavaScript,
javascript
you
you
can
can
use
use
match
match
to
to
find
find
all
all
the
the
matching
matching
patterns
patterns
within
within
a
a
string.
string
Search
search
to
to
test
test
for
for
a
a
single
single
match.
match
And
and
replace
replace
to
to
replace
replace
the
the
matching
matching
patterns.
patterns
But
but
before
before
you
you
can
can
put
put
these
these
to
to
use,
use
you
you
need
need
to
to
know
know
how
how
to
to
write
write
a
a
regular
regular
expression.
expression
In
in
JS,
js
we
we
can
can
do
do
that
that
with
with
the
the
literal
literal
syntax
syntax
by
by
starting
starting
with
with
2
2
forward
forward
slashes.
slashes
Between
between
these
these
characters
characters
is
is
where
where
we
we
define
define
our
our
search
search
pattern.
pattern
You
you
can
can
find
find
an
an
exact
exact
match
match
by
by
simply
simply
typing
typing
the
the
string
string
you're
you're
looking
looking
for.
for
By
by
default,
default
it
it
will
will
only
only
find
find
the
the
first
first
match.
match
However,
however
you
you
can
can
change
change
this
this
behavior
behavior
by
by
adding
adding
a
a
flag
flag
to
to
the
the
right
right
side
side
of
of
the
the
closing
closing
slash.
slash
The
the
g
g
flag
flag
means
means
global,
global
and
and
we'll
we'll
look
look
for
for
multiple
multiple
matches
matches
in
in
the
the
text.
text
And
and
you
you
can
can
add
add
additional
additional
flags
flags
here
here
as
as
well.
well
Now,
now
in
in
order
order
to
to
create
create
a
a
more
more
complex
complex
search
search
pattern,
pattern
you
you
can
can
bind
bind
a
a
handful
handful
of
of
special
special
characters
characters
within
within
your
your
expression.
expression
Use
use
a
a
vertical
vertical
bar
bar
as
as
a
a
logical
logical
or
or
to
to
match
match
one
one
string
string
or
or
the
the
other.
other
You
you
can
can
group
group
your
your
logic
logic
using
using
parentheses.
parentheses
This
this
isolates
isolates
your
your
code
code
from
from
the
the
rest
rest
of
of
the
the
pattern,
pattern
so
so
you
you
can
can
capture
capture
substrings.
substrings
Generics.
generics
You
you
can
can
use
use
quantifiers
quantifiers
to
to
control
control
how
how
often
often
the
the
preceding
preceding
pattern
pattern
is
is
allowed
allowed
to
to
occur.
occur
A
a
question
question
mark
mark
allows
allows
a
a
pattern
pattern
to
to
occur
occur
0
0
or
or
1
1
times.
times
An
an
asterisk
asterisk
allows
allows
a
a
pattern
pattern
to
to
occur
occur
0
0
or
or
multiple
multiple
times.
times
And
and
a
a
plus
plus
sign
sign
means
means
1
1
or
or
more
more
times.
times
Or
or
you
you
can
can
control
control
this
this
behavior
behavior
explicitly
explicitly
using
using
braces.
braces
Setting
setting
an
an
exact
exact
number
number
of
of
occurrences
occurrences
or
or
a
a
min
min
max
max
value.
value
You
you
can
can
use
use
a
a
backslash
backslash
in
in
your
your
pattern
pattern
to
to
escape
escape
any
any
of
of
these
these
special
special
characters.
characters
Or
or
a
a
backslash
backslash
might
might
refer
refer
to
to
a
a
character
character
class,
class
like
like
d
d
for
for
any
any
digit,
digit
or
or
w
w
for
for
any
any
word
word
character.
character
Make
make
these
these
a
a
capital
capital
letter,
letter
and
and
now
now
you
you
have
have
anything
anything
that's
that's
not
not
a
a
digit
digit
or
or
not
not
a
a
word
word
character.
character
You
you
can
can
use
use
brackets
brackets
to
to
define
define
your
your
own
own
custom
custom
character
character
sets,
sets
like
like
a
a
range
range
of
of
all
all
capital
capital
letters
letters
from
from
a
a
to
to
z,
z
or
or
a
a
custom
custom
character
character
set
set
that
that
you
you
create.
create
And
and
you
you
can
can
negate
negate
the
the
set
set
by
by
adding
adding
a
a
caret
caret
in
in
front
front
of
of
it.
it
But
but
Like
like
I
i
said
said
at
at
the
the
beginning,
beginning
regex
regex
is
is
not
not
an
an
easy
easy
thing
thing
to
to
learn.
learn
Check
check
out
out
my
my
cheat
cheat
sheet
sheet
on
on
FireShip
fireship
IO
io
for
for
a
a
bunch
bunch
of
of
common
common
examples
examples
that
that
I
i
find
find
useful.
useful
And
and
use
use
awesome
awesome
tools
tools
like
like
regexer.com
regexer.com
to
to
interactively
interactively
test
test
and,
and
more
more
importantly,
importantly
understand
understand
exactly
exactly
what
what
your
your
code
code
is
is
doing.
doing
This
this
has
has
been
been
Regular
regular
Expressions
expressions
in
in
100
100
seconds.
seconds
Hit
hit
the
the
like
like
button
button
if
if
you
you
want
want
to
to
see
see
more
more
videos
videos
like
like
this.
this
Thanks
thanks
for
for
watching,
watching
and
and
I
i
will
will
see
see
you
you
in
in
the
the
next
next
one.
one
success
The speaker explains the use of regular expressions in programming language, including validating user generated input and searching through large body of text. They also provide instructions on how to write regular expressions using literal syntax and adding flags to the end of your code. The speaker also suggests using tools like Bootstraper.com to test and understand code use.
Regular Expressions (RegEx) in 100 Seconds
Learn how to use Regular Expressions, or RegEx, in 100 Seconds. Grab the cheatsheet here https://fireship.io/lessons/regex-cheat-sheet-js/

RegExr Tool https://regexr.com/

#regex #js #100SecondsOfCode

Install the quiz app 🤓

iOS https://itunes.apple.com/us/app/fireship/id1462592372?mt=8
Android https://play.google.com/store/apps/details?id=io.fireship.quizapp

Upgrade to Fireship PRO at https://fireship.io/pro
Use code lORhwXd2 for 25% off your first payment. 

My VS Code Theme

- Atom One Dark 
- vscode-icons
- Fira Code Font