[Bioperl-l] Sequence matching problem!
Sendu Bala
bix at sendu.me.uk
Sun Feb 25 10:45:21 UTC 2007
Kurt Gobain wrote:
> Code works perfectly fine...but...sum time its not givin reqd o/p..For eg.
> If I type sequence as "GATCAAGTCAGGAT" & pattern to be matched as T.*A..then
> o/p which I am getting frm above prog is TCAAGTCAGGA instead of TCA...
> & 1 more thing Is there n e chance by which I can replace T*A to T.*A cos
> the code which I need to write says T*A shod be only the input not T.*A..So
> Can we use replacment reg ex...sumthing like
> $pattern =~ s/.*/*/...or sumthing else...
> But its kinda givin sum error again...Dam! Regex is really hairy!!...:P
These aren't Bioperl questions. For regular expression help see:
http://perldoc.perl.org/perlretut.html
Basically, you want a non-greedy match, so T.*?A
You can convert T*A by doing s/\*/.*?/
Here are some more regexs for you:
s/sum/some/g
s/frm/from/g
s/n e/any/g
etc...
More information about the Bioperl-l
mailing list