Forum Moderators: coopster

Message Too Old, No Replies

( a ¦ b) * c

would like to confirm its meaning

         

H2O_aa

7:34 pm on Feb 22, 2005 (gmt 0)

10+ Year Member



I am studying regular expression and would like to confirm the meaning of ( a ¦ b) * c.

To my understanding, that means 0 or more a's OR 0 or more b's ending in a c, right? (c, ac, aac, aaac, bc, bbc, bbbc)

The website where I got this says it means a string that has a sequence of alternating a's and b's ending in a c, which doesn't sound right to me.

Appreciate your clarification.

Garfield

7:43 pm on Feb 22, 2005 (gmt 0)

10+ Year Member



The website is right. That regex evaluates expressions that contains any number of a's and/or b's followed by a c.

(a¦b) is either a or b. The asterisk evaluates this expression any number of times. So it can become 'ab' or 'bbbbababa' or whatever combination you want.

What you mean would be this: (a*¦b*)c

Cheers