Character Class
Matching Specific Characters
You have a test string S. Your task is to write a regex that will match S with following conditions:
S must be of length:
6
First character:
1
,2
or3
Second character:
1
,2
or0
Third character:
x
,s
or0
Fourth character:
3
,0
,A
ora
Fifth character:
x
,s
oru
Sixth character:
.
or,
Excluding Specific Characters
You have a test string S. Your task is to write a regex that will match S with the following conditions:
S must be of length
6
.First character should not be a
digit
(1, 2, 3, 4, 5, 6, 7, 8, 9 or 0).Second character should not be a
lowercase vowel
(a, e, i, o or u).Third character should not be
b
,c
,D
orF
.Fourth character should not be a
whitespace character
( \r, \n, \t, \f or <space> ).Fifth character should not be a
uppercase vowel
(A, E, I, O or U).Sixth character should not be a
.
or,
symbol.
Matching Character Ranges
Write a RegEx that will match a string satisfying the following conditions:
The string’s length is >= 5.
The first character must be a lowercase English alphabetic character.
The second character must be a positive digit. Note that we consider zero to be neither positive nor negative.
The third character must not be a lowercase English alphabetic character.
The fourth character must not be an uppercase English alphabetic character.
The fifth character must be an uppercase English alphabetic character.
Last updated