0% found this document useful (0 votes)
6 views

Regex In JavaScript

Uploaded by

wevofo5056
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views

Regex In JavaScript

Uploaded by

wevofo5056
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 7

/(reg)ex/

in JS

www.scribbler.live
Regex ?
Regular expressions (regex) are
powerful tools for pattern matching and
string manipulation in JavaScript.

They allow you to define patterns to


search for, extract, or replace specific
substrings within strings.
Where can
you use it?

1 FORM VALIDATION

2 DATA EXTRACTION

3 STRING MANIPULATION

4 SEARCH FUNCTIONALITY
test() Method
test() is a method available on RegExp
objects in JavaScript that checks if a
pattern exists within a string.

It returns true if the pattern is found,


and false otherwise.
exec() Method
exec() is another method available on
RegExp objects that searches a string
for a specified pattern.

It returns an array containing the


matched substring, along with
additional information about the match,
or null if no match is found.
Using Regular
Expressions
Regular expressions can contain various
components, including literals,
character classes, quantifiers, and more,
allowing you to define complex
matching criteria.
Keep Exploring
Javascript
with us!
Share this with a friend who needs it and
make sure to practice these in scribbler.

Scribbler.live
Free and Open Interface to
experiment JavaScript

You might also like