in reply to regexp g option: finds all occurrences? ha!!

Didn't this just come up yesterday? Ah yes, here it is: multiple matches with regexp... and it was two days ago, not yesterday. ;)

There are some great solutions contained in that thread. I particluarly liked the one that used pos as an lvalueable function. I wish the answer I provided in that thread had been so slick. You may even see the person who started the thread in class on Monday. Be sure to thank him! lol.


Dave


"If I had my life to do over again, I'd be a plumber." -- Albert Einstein
  • Comment on Re: regexp g option: finds all occurrences? ha!!

Replies are listed 'Best First'.
Re: Re: regexp g option: finds all occurrences? ha!!
by cyphedude (Initiate) on Oct 12, 2003 at 22:15 UTC
    Amazingly, one of the solutions worked perfectly.

    my $regexp = "..g.{18}c"; my @antisense_oligos; $_ = $input_seq; do{ push @antisense_oligos, $1 if (m/^($regexp)/) } while ( s/^.// ); $,="\n"; print @antisense_oligos;


    When I get the chance, I'll try to put pos() to work.

    Thank you!!!
      Another way you may find quicker depending on how large your input string is is to use substr to nibble N chars at a time and then use the next pos to grab the next group of chars. This should be fairly speedy with little of the overhead of the above.


      -Waswas