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 of even digits.

  • The last 5 characters should consist of odd digits or whitespace characters.


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.


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


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.


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.

Last updated

Was this helpful?