Thursday, 19 September 2013

Grouping Regular Expression in Python

Grouping Regular Expression in Python

I'm having a problem. I'm trying to figure out what is the regular
expression for the following situation, where I want to match one of the
follwoing if returned back.
ABC 1 or
ABC 1 0 or
ABC 1 0 1 or
ABC 1 0 1 0 or etc
I'm trying the following to acheive this but its only matching the first
string (ABC 1).
regular expression: ABC (1|0)+
I have been trying to figure this out for a long time and I can't seem to
figure it out. Could someone please help?
Thanks

No comments:

Post a Comment