Java Reference
In-Depth Information
application. With regular expressions, you can just give the pattern ^T[aeiou]\w*! . That is,
^ and T as before, followed by a character class listing the vowels, followed by any number
of word characters ( \w* ), followed by the exclamation point.
Figure 4-1. REDemo with simple examples
“But wait, there's more!” as my late, great boss Yuri Rubinsky used to say. What if you want
to be able to change the pattern you're looking for at runtime ? Remember all that Java code
you just wrote to match T in column 1, plus a vowel, some word characters, and an exclama-
tion point? Well, it's time to throw it out. Because this morning we need to match Q , followed
by a letter other than u , followed by a number of digits, followed by a period. While some of
Search WWH ::




Custom Search