[Bioperl-l] regular expression help!

Willy West corenth at gmail.com
Sun Jan 16 09:53:55 EST 2005


oops- i'd forgotten to "reply to all" with this... i apologize.


On Sun, 16 Jan 2005 11:13:45 +0100, Aerts, Jan <Jan.Aerts at wur.nl> wrote:
> The problem is (or I might miss something here), that he wants to _test_ a regex. It's not possible to write something like
> $_ =~ /(.*)(.*)foo(\2)(.*)/e
> I think...
> 
> jan.

now i'm trying to do this with the test regex and am not successful :(
  this is an interesting problem and i really would love to find a
way..

one solution would be to explode the whole thing in another
subroutine... but if it's
not  what you want, i'm not yet sure how to do it.

good challenge though.....

:)

> 
> 
> -----Original Message-----
> From:   Willy West [mailto:corenth at gmail.com]
> Sent:   Sun 16-Jan-05 00:09
> To:     Aerts, Jan
> Cc:
> Subject:        Re: [Bioperl-l] regular expression help!
> On Sat, 15 Jan 2005 15:17:28 +0100, Aerts, Jan <Jan.Aerts at wur.nl> wrote:
> > You're right... Should have looked at the actual expression.
> > Idea: is it possible in this case to call subroutines from within a regex and evaluating them using the 'e' switch?
> 
> if i recall::
> 
> sub foo {
>            return 'hello genome';
> }
> 
> $data = "ih ho hum bababa";
> 
> $data =~ s/ih/foo/e; #one way to do it.
> 
> print "$data\n";
> 
> seems to work..


-- 
Willy
http://www.hackswell.com/corenth


More information about the Bioperl-l mailing list