in reply to Re: REgular expression to check the string that allows "a","b" and "c" to occur only once in any order.
in thread REgular expression to check the string that allows "a","b" and "c" to occur only once in any order.

Update: Nicely re-worked. Previously it didn't work but now it does. Nice job. I'm leaving my initial response here anyway, but it's no longer pertinent.

That doesn't work because it incorrectly matches invalid strings.

If you change

my $str="abc";
to
my $str="aaa";
You'll still get a match even though that's not supposed to be a valid string. You'll have to go a bit more complicated in the regex to exclude the false hits.

Update: I was missing my 2nd code snip.
--
I used to drive a Heisenbergmobile, but every time I looked at the speedometer, I got lost.
  • Comment on Re^2: REgular expression to check the string that allows "a","b" and "c" to occur only once in any order.
  • Select or Download Code