This makes sure {a,b,} and {a,b,a,b,} are matched, but {a,b,c,} is
not. (only pairs)
Now, I want to extend this for any string and not just a and b. So, I
modify the above regex to
^((.*,)(.*,))+$
But it no longer matches only pairs. {ae,bee,} is matched but
{ae,bee,aer,} is also matched! I just don't understand why. What I am
missing here? I am using C#.
On Sun, Jun 14, 2009 at 8:45 AM, Bruce <bruce.james....@gmail.com> wrote:
> Hi
> I have a basic regex question.
> ^(([ab],)([ab],))+$
> This makes sure {a,b,} and {a,b,a,b,} are matched, but {a,b,c,} is
> not. (only pairs)
> Now, I want to extend this for any string and not just a and b. So, I
> modify the above regex to
> ^((.*,)(.*,))+$
> But it no longer matches only pairs. {ae,bee,} is matched but
> {ae,bee,aer,} is also matched! I just don't understand why. What I am
> missing here? I am using C#.