Regular Expressions 101

Community Patterns

Find all words which have 2 characters, then EITHER OR then POINTER

0

Regular Expression
Python

r"
^ab.*[zy].*s
"

Description

Write a regular expression to find all words which have the first two characters of "ab", and after that at some point EITHER a "z" or a "y", and then after that at some point an "s". The "s" does not have to be at the end of the word.

So the following words are all examples of words which you should be able to find (although there are many more words which match which are not listed here):

Submitted by anonymous - 4 years ago