in reply to Re^2: Extract sequence of UC words?
in thread Extract sequence of UC words?
Unfortunately this would also match "TEST SENTENCE" (note the trailing whitespace).
The following test illustrates another method:
#!/usr/bin/perl -w my $data = <<'EOF'; This is a sentence. THIS \ IS A SENTENCE. This is \ a SEQUENCE OF UPPER WORDS and \ this is not. EOF while ( $data =~ m/(\b(?:[A-Z]+(?:\s+[A-Z]+)*)+\b)/g ) { print "Upper Sentence: \"$1\"\n"; }
Outputs:
Upper Sentence: "THIS IS A SENTENCE" Upper Sentence: "SEQUENCE OF UPPER WORDS"
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: Extract sequence of UC words?
by BrowserUk (Patriarch) on Aug 18, 2008 at 17:13 UTC | |
by monarch (Priest) on Aug 18, 2008 at 17:58 UTC | |
by BrowserUk (Patriarch) on Aug 19, 2008 at 06:31 UTC | |
|
Re^4: Extract sequence of UC words?
by johngg (Canon) on Aug 19, 2008 at 14:05 UTC |