Repetitions
Matching {x} Repititions
You have a test string S. Your task is to write a regex that will match S using the following conditions:
S must be of length equal to
45.The first 40 characters should consist of
letters(both lowercase and uppercase), or ofeven digits.The last 5 characters should consist of
odd digitsorwhitespace characters.
^[a-zA-z02468]{40}[13579\s]{5}$Matching {x, y} Repititions
You have a test string S. Your task is to write a regex that will match S using the following conditions:
S should begin with 1 or 2
digits.After that, S should have 3 or more
letters(both lowercase and uppercase).Then S should end with up to 3
.symbol(s). You can end with 0 to 3.symbol(s), inclusively.
^\d{1,2}[a-zA-Z]{3,}\.{,3}$Matching Zero Or More Repititions
You have a test string S. Your task is to write a regex that will match S using the following conditions:
S should begin with 2 or more
digits.After that, S should have 0 or more
lowercase letters.S should end with 0 or more
uppercase letters
^\d{2,}[a-z][A-Z]$Matching One Or More Repititions
You have a test string S. Your task is to write a regex that will match S using the following conditions:
S should begin with 1 or more
digits.After that, S should have 1 or more
uppercase letters.S should end with 1 or more
lowercase letters.
^\d+[A-Z]+[a-z]+$Matching Ending Items
Write a RegEx to match a test string, S, under the following conditions:
S should consist of only lowercase and uppercase letters (no numbers or symbols).
S should end in
s.
^[a-zA-Z]*s$Last updated
Was this helpful?