filmov
tv
JavaScript for beginners - Chapter 31 - Using regular expressions in javascript part -1

Показать описание
Using regular expressions in JavaScript:
What is Regular Expression ?
A regular expression is a sequence of characters that forms a search pattern.
Resources for learning, writing and testing regular expressions
Basics of regular expressions :
Expresso is one of the free tools available :
Resources for learning, writing and testing regular expressions
RegExr is a HTML/JS based tool for creating, testing, and learning about regular expressions.
Regular Expression Library :
Example :
Find the word Lorem in a given string. This will also match with word Lorems.
“Lorem”.
1 . To find the word “Lorem” as a whole word, include \b on either sides of the word expression
\bLorem\b
2. To find a 4 digit number, \d indicates to find a digit.
\b\d \d \d \d\b
We can avoid the repetition of \d by using curly braces as shown below :
\b\d{4}\b
It can also be written as
\b[0-9]{4}\b
Brackets are used to find a range of characters.
[a-z] - Find any of the characters between the brackets.
[0 - 9] – Find any of the digits between the brackets. This is equivalent to \d.
(a|b) – Find any of the characters a or b.
ankpro
ankpro training
C#
C sharp
Bangalore
Rajajinagar
Selenium
Coded UI
Mobile automation testing
Mobile testing
JQuery
JavaScript
.Net
Components of the .Net framework
Hello World
What is Regular Expression ?
A regular expression is a sequence of characters that forms a search pattern.
Resources for learning, writing and testing regular expressions
Basics of regular expressions :
Expresso is one of the free tools available :
Resources for learning, writing and testing regular expressions
RegExr is a HTML/JS based tool for creating, testing, and learning about regular expressions.
Regular Expression Library :
Example :
Find the word Lorem in a given string. This will also match with word Lorems.
“Lorem”.
1 . To find the word “Lorem” as a whole word, include \b on either sides of the word expression
\bLorem\b
2. To find a 4 digit number, \d indicates to find a digit.
\b\d \d \d \d\b
We can avoid the repetition of \d by using curly braces as shown below :
\b\d{4}\b
It can also be written as
\b[0-9]{4}\b
Brackets are used to find a range of characters.
[a-z] - Find any of the characters between the brackets.
[0 - 9] – Find any of the digits between the brackets. This is equivalent to \d.
(a|b) – Find any of the characters a or b.
ankpro
ankpro training
C#
C sharp
Bangalore
Rajajinagar
Selenium
Coded UI
Mobile automation testing
Mobile testing
JQuery
JavaScript
.Net
Components of the .Net framework
Hello World