Strings Tutorial, Pattern Matching
From Progzoo
These questions use the simple text file greeks.txt - this file includes around three hundred characters from Greek legends.
You may want to review the following:
- matches from Sun
- Regular expressions from Sun
Gaea
Earth goddess Gaea matches the pattern ".a.a"
Find all the names that match the pattern ".a.a"
Icarus
Icarus perished because he flew too close to the sun on wings fixed with wax.
Icarus is one of several names containing the string "ca".
Print the names matching the pattern ".*ca.*"
Scrabble favourites
Print the names that include Q or Z or q or z
Styx
The river Styx gave Achilles his near invincibilty.
The word contains no vowels (aeiou).
Print the names that are a sequence of non-vowels.
Bellerophon
Bellerphon defeated the Chimera with the help of the winged horse Pegasus.
The name Bellerphon includes a double letter "ll".
Print names that include consecutive double letters.