At 12:43 PM -0400 9/8/99, Ronald J Kimball wrote: >That fails on the same string I presented for David's regex: >'--a--a--a--a--' because it requires adjacent 'a's. > > $string =~ /^[^a]*(a[^a]*a[^a]*)*$/ && > $string =~ /^[^b]*b[^b]*(b[^b]*b[^b]*)*$/ No, it doesn't. For instance, it passes ' a b a ' just fine. OTOH, your test string ('--a--a--a--a--') does not meet the criteria for the question, as it does not contain an odd number of 'b's. -r P.S. To help us all read from the same page, here is a simple test harness I hacked up: for (;;) { print 'Next? '; $string = <>; chop $string; if ($string =~ /^[^a]*(a[^a]*a[^a]*)*$/ && $string =~ /^[^b]*b[^b]*(b[^b]*b[^b]*)*$/) { print "pass ($string)\n\n"; } else { print "fail ($string)\n\n"; } } -- Rich Morin: rdm@cfcl.com, +1 650-873-7841, http://www.ptf.com/~rdm Prime Time Freeware: info@ptf.com, +1 408-433-9662, http://www.ptf.com MacPerl: http://www.macperl.com, http://www.ptf.com/ptf/products/MPPE MkLinux: http://www.mklinux.apple.com, http://www.ptf.com/ptf/products/MKLP ==== Want to unsubscribe from Fun With Perl? Well, if you insist... ==== Send email to <fwp-request@technofile.org> with message _body_ ==== unsubscribe