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

Re: [FWP] counting in REs



On Wed, Sep 08, 1999 at 08:26:47AM -0700, Rich Morin wrote:
> 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...
> 

Are we talking actual _regular_ expressions here?  I think Task 3 would be
quite simple using positive lookahead assertions.

Ronald


==== Want to unsubscribe from Fun With Perl?  Well, if you insist...
==== Send email to <fwp-request@technofile.org> with message _body_
====   unsubscribe