Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Javascript Regular Expressions

You're reading from   Javascript Regular Expressions Leverage the power of regular expressions to create an engaging user experience

Arrow left icon
Product type Paperback
Published in May 2015
Publisher
ISBN-13 9781783282258
Length 112 pages
Edition 1st Edition
Languages
Arrow right icon
Toc

Quantifiers

In the following table, you can find the patterns for quantifiers, which specify how many instances of a character, group, or character class must be present in an input for a match to be found.

Pattern

Description

Example

{n}

This matches exactly n occurrences of a regular expression.

/\d{5}/ matches "12345" (five digits) in "1234567890".

{n,}

This matches n or more occurrences of a regular expression.

/\d{5,}/ matches "1234567890" (minimum of five digits) in "1234567890".

{n,m}

This matches n to m number of occurrences of a regular expression.

/\d{5,7}/ matches "1234567" (minimum of five digits and a maximum of seven digits) in "1234567890".

*

This matches zero or more occurrences and is equivalent to {0,}.

/fo*/ matches "foo" in "foo" and matches "foooooooo" in "fooooooooled".

+

This matches one or more occurrences and is equivalent to {1,}.

...

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime
Banner background image