Re: Python re.search simple question

2014-12-08 Thread Denis McMahon
On Mon, 08 Dec 2014 12:22:37 +0530, Ganesh Pal wrote: pattern > 'Token-based migrations cannot be mixed with level-based: [prev 0 , now > 1]' Because [] defines a character class in a regex, if you want literal [ and ] you need to escape them with backslash. [prev 0 , now 1] -> match any s

Re: Python re.search simple question

2014-12-07 Thread Ganesh Pal
Thanks guys , I escaped the '[' character and my issue is sloved .. Thank you guys u all rock :) Regards, Ganesh On Mon, Dec 8, 2014 at 12:41 PM, Zachary Ware wrote: > On Mon, Dec 8, 2014 at 12:52 AM, Ganesh Pal wrote: > > Hi Folks , > > > > This might seem to be very trivial question but ia

Re: Python re.search simple question

2014-12-07 Thread Jussi Piitulainen
Jussi Piitulainen writes: > Ganesh Pal writes: > > > why is re.search failing in the below case ?? > > Your pattern, '... level-based: [prev 0 , now 1]', matches a literal > string '--- level-based: ' followed by 'p', 'r', 'e', 'v', ' ', '0', > ..., or '1', none of which is the '[' found in you

Re: Python re.search simple question

2014-12-07 Thread Zachary Ware
On Mon, Dec 8, 2014 at 12:52 AM, Ganesh Pal wrote: > Hi Folks , > > This might seem to be very trivial question but iam breaking my head over > it for a while . > > My understanding is that re.search should search for the match anywhere in > the string . > > > why is re.search failing in the bel

Re: Python re.search simple question

2014-12-07 Thread Shiyao Ma
On Dec 08 at 12:22 +0530, Ganesh Pal wrote: > Hi Folks , > > This might seem to be very trivial question but iam breaking my head over > it for a while . > > My understanding is that re.search should search for the match anywhere in > the string . > > > why is re.search failing in the below case

Re: Python re.search simple question

2014-12-07 Thread Jussi Piitulainen
Ganesh Pal writes: > why is re.search failing in the below case ?? Your pattern, '... level-based: [prev 0 , now 1]', matches a literal string '--- level-based: ' followed by 'p', 'r', 'e', 'v', ' ', '0', ..., or '1', none of which is the '[' found in your text at that position. Are you sure yo

Python re.search simple question

2014-12-07 Thread Ganesh Pal
Hi Folks , This might seem to be very trivial question but iam breaking my head over it for a while . My understanding is that re.search should search for the match anywhere in the string . why is re.search failing in the below case ?? >>> pattern 'Token-based migrations cannot be mixed wit