Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

Re: Simple regular expression that isn't simple

by mickeyn (Priest)
on Feb 28, 2006 at 15:40 UTC ( #533386=note: print w/ replies, xml ) Need Help??


in reply to Simple regular expression that isn't simple

you should try something simpler (untested):

$seqs =~ /^(>.*)>/ms
Enjoy,
Mickey


Comment on Re: Simple regular expression that isn't simple
Download Code
Replies are listed 'Best First'.
Re^2: Simple regular expression that isn't simple
by QM (Vicar) on Feb 28, 2006 at 18:10 UTC
    $seqs =~ /^(>.*)>/ms
    This will grab everything from the start of the string (assuming the string starts with >, upto but not including the last >.

    While technically correct, reading between the lines the OP probably wants to grab the data in chunks that start with >. (Otherwise, substr would have been a better choice, no?).

    You have to make the * non-greedy. Better to just use a negated character class...

    I see that davorg's suggestion is what I was heading for..

    -QM
    --
    Quantum Mechanics: The dreams stuff is made of

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://533386]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (10)
As of 2015-07-31 08:57 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (276 votes), past polls