Re: How to write this repeat matching?

2014-07-07 Thread rxjwg98
On Sunday, July 6, 2014 3:26:44 PM UTC-4, Ian wrote: On Sun, Jul 6, 2014 at 12:57 PM, rxjw...@gmail.com wrote: I write the following code: ... import re line = abcdb matchObj = re.match( 'a[bcd]*b', line) if matchObj: print matchObj.group() : ,

Re: How to write this repeat matching?

2014-07-07 Thread Anssi Saari
rxjw...@gmail.com writes: Because I am new to Python, I may not describe the question clearly. Could you read the original problem on web: https://docs.python.org/2/howto/regex.html It says that it gets 'abcb'. Could you explain it to me? Thanks again Actually, it tries to explain how *

Re: How to write this repeat matching?

2014-07-07 Thread Ian Kelly
On Mon, Jul 7, 2014 at 7:30 AM, rxjw...@gmail.com wrote: Because I am new to Python, I may not describe the question clearly. Could you read the original problem on web: https://docs.python.org/2/howto/regex.html It says that it gets 'abcb'. Could you explain it to me? Thanks again The

How to write this repeat matching?

2014-07-06 Thread rxjwg98
Hi, On Python website, it says that the following match can reach 'abcb' in 6 steps: . A step-by-step example will make this more obvious. Let's consider the expression a[bcd]*b. This matches the letter 'a', zero or more letters from the class [bcd], and finally ends with a 'b'.

Re: How to write this repeat matching?

2014-07-06 Thread MRAB
On 2014-07-06 19:57, rxjw...@gmail.com wrote: Hi, On Python website, it says that the following match can reach 'abcb' in 6 steps: . A step-by-step example will make this more obvious. Let's consider the expression a[bcd]*b. This matches the letter 'a', zero or more letters from

Re: How to write this repeat matching?

2014-07-06 Thread Ian Kelly
On Sun, Jul 6, 2014 at 12:57 PM, rxjw...@gmail.com wrote: I write the following code: ... import re line = abcdb matchObj = re.match( 'a[bcd]*b', line) if matchObj: print matchObj.group() : , matchObj.group() print matchObj.group(0) : , matchObj.group() print