"Beau E. Cox" wrote:
> >>3. How do I do a pattern search that looks for capital
> >>words only?
> 
> Try this:
> 
>         my $test = "Test: HELLO my name is BEAU Cox";
>         $_ = $test;
>         my @cap_words = /\s*([A-Z0-9\.@_]+?)\s+/g;
>         print "@cap_words\n";
> 
> NOTE: the search is for A-Z, 0-9, ., @, and _. Add (subtract) as required.
> Don't forget to "escape" (\) the regex "magic" characters.
> 

Another way is (the way show is a good way!) to use Posix abilities of
your OS.
Try to find the captal words with:

my @capwords = /\b([[:upper:]]+)\b/g;

[:upper:] takes care about locale settings (and is more readable).

Note also, that I used \b to mark the "word break", not \s*

It would make a difference e.g. with the sentence:
"TEST: HELLO my name is ANDREA Holstein"

Good Luck,
Andrea

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to