Strings Tutorial, Pattern Matching

From Progzoo
Jump to: navigation, search

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:

Gaea

Earth goddess Gaea matches the pattern ".a.a"

Find all the names that match the pattern ".a.a"


[Font] [Default] [Show] [Resize] [History] [Profile]

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.*"



[Font] [Default] [Show] [Resize] [History] [Profile]

Scrabble favourites

Print the names that include Q or Z or q or z



[Font] [Default] [Show] [Resize] [History] [Profile]

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.



[Font] [Default] [Show] [Resize] [History] [Profile]

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.



[Font] [Default] [Show] [Resize] [History] [Profile]