Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine

Re: Regxp: signaling when to stop

by Sidhekin (Priest)
on Jun 20, 2007 at 15:20 UTC ( #622281=note: print w/replies, xml ) Need Help??

in reply to Regxp: signaling when to stop

Not just to be contrary, but this is no place for the non-greedy quantifiers. What if the "unpredictable sequence" contains the string "consists"?

On the assumption that the rest of the string is less "unpredictable", you want to match everything on this line between the first "sequence" and the last "consists". Hence my suggestion:

my ($name) = m/Sequence (.*) consists/;

(If the rest of the string may be as unpredictable, I'd suggest you write a full parser instead. Looks like there's a fair chance you won't have to though.)

print "Just another Perl ${\(trickster and hacker)},"
The Sidhekin proves Sidhe did it!

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://622281]
[LanX]: http://perldoc. .html#Example%3a- Altering-Concise- Renderings
[LanX]: :-/
[Corion]: Heh ;)
[Corion]: I might do a release of Filter::Simple, which has/"causes" bugs in line numbering, which also hasn't bothered too many people ;)
[choroba]: LanX do you mean s/add_style/ set_style/?
[LanX]: choroba: yes
[LanX]: line numbering is easy to fix with # line dircetives
[LanX]: I just wrote my first source filter, without changing the source

How do I use this? | Other CB clients
Other Users?
Others exploiting the Monastery: (11)
As of 2017-04-24 15:08 GMT
Find Nodes?
    Voting Booth?
    I'm a fool:

    Results (442 votes). Check out past polls.