http://qs321.pair.com?node_id=704933


in reply to Extract sequence of UC words?

It grabs only one word because you are matching for a sequence of upper case letters only. To have it match 'TEST SENTENCE' you'll have to have it match upper case letters OR spaces.

But wait! The regex will then actually match ' TEST SENTENCE ' (including the space before and after the capitalized sequence). So what you really need is to make a match of:

  1. One upper case letter
  2. Any number of upper case letters/spaces
  3. One upper case letter

The requirement to match a beginning and ending upper case letter will also make it not match just the 'F' of 'Foo'.

Edit: gaal is smarter than I, heh.