Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change

Re^6: Extract sequence of UC words?

by BrowserUk (Pope)
on Aug 19, 2008 at 06:31 UTC ( #705145=note: print w/replies, xml ) Need Help??

in reply to Re^5: Extract sequence of UC words?
in thread Extract sequence of UC words?

I upvoted your post above, but still your regex m/(\b(?:[A-Z]+(?:\s+[A-Z]+)*)+\b)/g made me squirm. Whenever I see sequences of nested quantifiers like that:+)*)+ I get uncomfortable, remembering various pathelogical cases I've constructed in the past.

To that end, I thunk again, and came up with this which I believe meets the 'spec', whilst avoiding the nested quantifiers;

m[ ( \b [A-Z] (?: [A-Z\s]* [A-Z] )? \b ) ]gx

Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://705145]
[Corion]: Hmm. My overkill logging of transactions seems to bear fruit. I've built it in a way that the decision on every transaction must be logged, even if the transaction is just skipped, to prevent silent skips.
[Corion]: Now, three years in production, it found a situation (during development) where stuff was skipped without getting a log message.

How do I use this? | Other CB clients
Other Users?
Others contemplating the Monastery: (4)
As of 2017-08-21 07:42 GMT
Find Nodes?
    Voting Booth?
    Who is your favorite scientist and why?

    Results (318 votes). Check out past polls.