On Nov 22, Edward Wijaya said:

$str1      = "ATC[TG]CC";
# into
$ans_str1  = "ATCNCC";

$str2    ="ATC[TG]CCGC[ACTG]";
#into
$ans_str2="ATCNCCGCN";

The simplest way I can think of is

  $string =~ s/\[[ACTG]+\]/N/g;

which is very explicit: it replaces a '[' followed by A's, C's, T's, and/or G's, followed by a ']' with 'N'.

--
Jeff "japhy" Pinyan        %  How can we ever be the sold short or
RPI Acacia Brother #734    %  the cheated, we who for every service
http://www.perlmonks.org/  %  have long ago been overpaid?
http://princeton.pm.org/   %    -- Meister Eckhart

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to