For tutorial video click here
- The below regular expression code will match with all those words which first letter should be
a
orb
orc
or1
or2
or3
and next 3 characters should be 000. Besides this, no word will be match. E.g.a000 b000 2000
should match bute000
will not match.
/[abc123]000/
- The below regular expression will match all the words those has last 3 characters 000 and the first character will be everything except
p
&e
. e.g.a000 b000 2000 e000
will be match butp000
will not match
/[^pe]000/
- Match all the words that have
000
as last 3 characters and first letter should be anything. Thaen range regular expression should be used. Regular expression is case sensitive, so add all small characters and capital characters. e.g.A000 a000 d000 x000
should be match but2000
should not match.
[a-zA-Z]000
- First letter should be any character a - z including lower case and capital case and also any number. Then next 3 characters should be
000
.
[a-zA-Z0-9]000
- Match the numbers and the length is not specified. So any length of number word should be match.
/[0-9]+/
- Match only 11 length numbers like phone numbers.
/[0-9]{11}/
- Match all the characters but the lenght should be between 5 & 8. e.g.
helloworld
will match uptor
, then rest charactes should not match. But first 8 characters will match.
/[a-z]{5,8}/
- Match atleast 5 character long number. More than 5 characters number also should be match.
/[0-9]{5,}/
\d
match any digit character (same as[0-9]
).d
matches the literal character,'d'
but\d
matches any digit character.\w
match any word character (a-z, A-Z, 0-9 and _'s)\s
match a whitespace character (spaces, tabs etc)\t
match a tab character only