ovo has asked for the wisdom of the Perl Monks concerning the following question:
>gi|77641047|gb|ABB00395.1| I2 [Lycopersicon esculentum] TRTPSTSLVVDSGIFGRQNEIEDLVGRLLSMDTKGKNLAVVPIVGMGGLGKTTLAKAVYNDERVKKHFGL TAWFCVSEAYDAFRITKGILQEIGSTDLKADHNLNQLQVKVKESLKGKKFLIVLDDVWNDNYNEWDDLRN IFVQGDIGSKIIVTTRKNSVALMMGNEQISMNNLSTEASWSLFKRHAFENMNPMGYPELEEVGKQIAAKC KGLPLALKTLAGMLCSKSEIDEWKRILRSEIW >gi|77641045|gb|ABB00394.1| I2 [Lycopersicon esculentum] TRTPSTSLVVDSGIFGRQNEIEDLVGRLLSMDTKGKNLAVVPIVGMGGLGKTTLAKAVYNDERVKKHFGL TAWFCVSEAYDAFRITKGILQEIGSTDLKADHNLNQLQVKVKESLKGKKFLIVLDDVWNDNYNEWDDLRN (many more lines repeated like this)
I want to build a regular expression to capture everything between the ">" including the first ">" but excluding the last ">"
I thought this would work. Assume $seqs holds all of the above data.
$seqs =~ /^(\>.*(?=\>))/ms;
It doesn't, rather it captures the entire file. The trick appears to be in how to express the .* so that it grabs only until the next ">". How does one do this?
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Simple regular expression that isn't simple
by davorg (Chancellor) on Feb 28, 2006 at 15:55 UTC | |
|
Re: Simple regular expression that isn't simple
by duff (Parson) on Feb 28, 2006 at 15:37 UTC | |
|
Re: Simple regular expression that isn't simple
by prasadbabu (Prior) on Feb 28, 2006 at 15:37 UTC | |
|
Re: Simple regular expression that isn't simple
by thundergnat (Deacon) on Feb 28, 2006 at 18:30 UTC | |
|
Re: Simple regular expression that isn't simple
by Fletch (Bishop) on Feb 28, 2006 at 15:34 UTC | |
|
Re: Simple regular expression that isn't simple
by l3v3l (Monk) on Feb 28, 2006 at 17:05 UTC | |
|
Re: Simple regular expression that isn't simple
by mickeyn (Priest) on Feb 28, 2006 at 15:40 UTC | |
by QM (Parson) on Feb 28, 2006 at 18:10 UTC | |
|
Re: Simple regular expression that isn't simple
by Anonymous Monk on Feb 28, 2006 at 16:06 UTC |