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

Re^3: Determing if this regex matched

by merlyn (Sage)
on Aug 06, 2011 at 20:12 UTC ( #918990=note: print w/replies, xml ) Need Help??


in reply to Re^2: Determing if this regex matched
in thread Determing if this regex matched

Too much work!
my @items = ('"Title Text Example"', 'Title Text Example', ' Title Tex +t Example ',' "Title Text Example"'); foreach (@items) { if (s/^[\s"]+// or s/[\s"]+$//) { print "$_\n"; } }

-- Randal L. Schwartz, Perl hacker

The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in RFC 2119.

Replies are listed 'Best First'.
Re^4: Determing if this regex matched
by cormanaz (Chaplain) on Aug 06, 2011 at 20:30 UTC
    That's what toolic had before editing the his post. Doesn't work because if the first element of the or evaluates true the second one doesn't get evaluated, so if there's a quote/space at the beginning, quotes/spaces get left at the end.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://918990]
help
Chatterbox?
[Eily]: when did you become a bishop though? 428 xp that's not too long ago is it?
[Eily]: and congratulations :P
[choroba]: Eily++ # made the smiley on his face instead of in the message
[LanX]: weekend ... and waiting that chacellor choroba finally catches up ;-p
LanX last weekend or the one before (???)
choroba needs more questions to provide answers to
jedikaiti looked at last hour of CB, saw "boos" but read "boobs"

How do I use this? | Other CB clients
Other Users?
Others about the Monastery: (7)
As of 2017-09-20 15:54 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    During the recent solar eclipse, I:









    Results (237 votes). Check out past polls.

    Notices?