Re: Regular Expression: Matching substring

2006-04-12 Thread Kevin CH
Thank you for your reply. > Perhaps you are using grep, or you have stumbled on the old deprecated > "regex" module and are using that instead of the "re" module. Perhaps > not as you are using only 2 plain vanilla RE operations which should > work the same way everywhere. Perhaps you are having t

Re: Regular Expression: Matching substring

2006-04-12 Thread Kevin CH
Oh yea, I see what's my confusion now. In the first string, I didn't consider 11 and 0 matches the pattern without the repetition. Actually what I did is I entered the pattern and the test strings into kudos (a python regexp debugger) and got the match groups, which didn't have 11 and 0 as matche

Re: Regular Expression: Matching substring

2006-04-12 Thread Kevin CH
; or ``010" > or ``11", > right?:) Why it must expect "010"? Why not say "0110", since 1* can represent 0 or more repetitions. > > > Kevin CH 寫道: > > > Hi, > > > > I'm currently running into a confusion on regex and hop

Regular Expression: Matching substring

2006-04-12 Thread Kevin CH
Hi, I'm currently running into a confusion on regex and hopefully you guys can clear it up for me. Suppose I have a regular expression (0|(1(01*0)*1))* and two test strings: 110_1011101_ and _101101_1. (The underscores are not part of the string. They are added to show that both string has a sub