in reply to REgular expression to check the string that allows "a","b" and "c" to occur only once in any order.
Does you need to use a regex?
#!/usr/bin/perl use warnings; use strict; my @maybe = qw( abc bca cab cba bac acb aab abbc acc ); print "$_ ", ok($_) ? 'good' : 'no good', "\n" for @maybe; sub ok{ return y/a// > 1 ? 0 : y/b// > 1 ? 0 : y/c// > 1 ? 0 : 1; }
|
|---|