|Just another Perl shrine|
Re^2: REgular expression to check the string that allows "a","b" and "c" to occur only once in any order.by ww (Archbishop)
|on Dec 11, 2007 at 13:31 UTC||Need Help??|
Interesting approach for which ++.
.oO, however, that this allows cases such as when @testdata contains aabc. IMO that's NOT quite1 (strictly) prohibited by the (very loose) specs from OP:
Can anybody help to have a regular expression that checks that a,b and c occur in a string in any order.
BUT the presence of abbc in the list of invalid strings suggests that isha may want to requires that each permitted letter occur only once. (Others may well infer differently. As noted, I consider the spec to be imprecise... as is, ISTM, the general case when specs are written by example.)
1. because, in this case, while the initial "a" is doubled the $test does include an instance of each acceptable character; in other words, ISTM that aabc is NOT - strictly - prohibited in the sample of invalid strings, aab because aab can be read as prohibiting only an incomplete set of the chars a, b and c, while the invalid string abbc does not strictly prohibit having the lead character doubled. Am I being pedantic or fuzzy-brained?
I do find my own observations to fall short of precision+clarity. Maybe it's too early in the AM... :-)
Update: added the missing close-paren at the end of para 3