Practice Problems - Regular Expressions¶
Please write a regex that matches both “gray” and “grey”.
Please write a regex that matches a word that starts with an uppercase letter followed by at least one lowercase letter, like “Apple”, “Banana”, or “Carrot”.
Please write a regex to capture numbers with 5-7 digits. For example: 48105, 103028, 1234567.
Write a regex that captures words that start with a vowel (a, e, i, o, u), can have any number of characters from a-z after the vowel (including zero), and end with a consonant (any letters that are not a, e, i, o, u). For example, it should match “unicorn”, “it”, and “element”.
Write a regex that captures strings that have two digits followed by a period and then four letters from a to z.