
- HTML Tutorial
- HTML - Home
- HTML - Overview
- HTML - Basic Tags
- HTML - Elements
- HTML - Attributes
- HTML - Formatting
- HTML - Phrase Tags
- HTML - Meta Tags
- HTML - Comments
- HTML - Images
- HTML - Tables
- HTML - Lists
- HTML - Text Links
- HTML - Image Links
- HTML - Email Links
- HTML - Frames
- HTML - Iframes
- HTML - Blocks
- HTML - Backgrounds
- HTML - Colors
- HTML - Fonts
- HTML - Forms
- HTML - Embed Multimedia
- HTML - Marquees
- HTML - Header
- HTML - Style Sheet
- HTML - Javascript
- HTML - Layouts
- HTML References
- HTML - Tags Reference
- HTML - Attributes Reference
- HTML - Events Reference
- HTML - Fonts Reference
- HTML - ASCII Codes
- ASCII Table Lookup
- HTML - Color Names
- HTML - Entities
- HTML - Fonts Ref
- HTML - Events Ref
- MIME Media Types
- HTML - URL Encoding
- Language ISO Codes
- HTML - Character Encodings
- HTML - Deprecated Tags
What is the role of special characters in JavaScript Regular Expressions?
The frequency or position of bracketed character sequences and single characters can be denoted by a special character. Each special character has a specific connotation. The +, *, ?, and $ flags all follow a character sequence.
Sr.No | Expression & Description |
---|---|
1 | p+ It matches any string containing one or more p's. |
2 | p* It matches any string containing zero or more p's. |
3 | p? It matches any string containing at most one p. |
4 | p{N} It matches any string containing a sequence of N p's |
5 | p{2,3} It matches any string containing a sequence of two or three p's. |
6 | p{2, } It matches any string containing a sequence of at least two p's. |
7 | p$ It matches any string with p at the end of it. |
8 | ^p It matches any string with p at the beginning of it. |
Example
You can try to run the following code to learn how to work with special characters in JavaScript Regular Expressions −
<html> <head> <title>JavaScript Regular Expressions</title> </head> <body> <script> var myStr = "Welcome to our website! Welcome to Tutorialspoint!"; var reg = /Wel*/g; var match = myStr.match(reg); document.write(match); </script> </body> </html>
- Related Articles
- Role of Matcher.matches() method in Java Regular Expressions
- Role of Matcher.group() method in Java Regular Expressions
- What are regular expressions in JavaScript?
- Role of Matcher.find(int) method in Java Regular Expressions
- JavaScript Regular Expressions
- What is Regular Expressions?
- How to use special characters in Python Regular Expression?
- Write a Regular Expression to remove all special characters from a JavaScript String?
- Lookbehind Assertions JavaScript Regular Expressions
- What is the groups() method in regular expressions in Python?
- How can we separate the special characters in JavaScript?
- What are the properties of Regular expressions in TOC?
- Finding count of special characters in a string in JavaScript
- Unicode Property Escapes JavaScript Regular Expressions
- Named capture groups JavaScript Regular Expressions

Advertisements