[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

[FWP] counting in REs



A friend of mine recently presented me with three cases to match with
a regular expression:

   1)  test for an even number of 'a's in a string

   2)  test for an odd  number of 'b's in a string

   3)  test for an even number of 'a's
       and      an odd  number of 'b's in a string

Tasks 1 and 2 are pretty easy.  Task 3, however, is rather tricky.  I
will post some possible approaches in a followup...

-r
--
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