Regular Expressions 101

Community Patterns

1...56789...902

Community Library Entry

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 - 5 years ago