Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

Re: Regular expression for a comma separated string

by igoryonya (Pilgrim)
on Nov 24, 2014 at 07:07 UTC ( [id://1108228]=note: print w/replies, xml ) Need Help??


in reply to Regular expression for a comma separated string

I didn't test it, but see if it works:
([AGCT])(?!\1)([AGCT])(?!\1|\2)([AGCT])(?!\1|\2|\3)[AGCT],([AGCT])(?!\ +4)([AGCT])(?!\4|\5)([AGCT])(?!\4|\5|\6)[AGCT]
No, it would only do for 4 char strings only on each side.
What about:
my $str = 'some_str'; my @matches = ($str =~ /^([AGCT]{1,4}),([AGCT]{1,4})$/); if(2 == scalar @matches){ for my $match (@matches){ my %letters = (); map { $letters{$_} } ($match =~ /(.)/g); exit 0 if(scalar keys %letters != length $match); } }else{ exit 0; } print $str;
:) also didn't test, maybe doesn't work.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1108228]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others rifling through the Monastery: (6)
As of 2024-03-29 08:17 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found