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 single

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 with

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

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 Zachary Ware
On Mon, Dec 8, 2014 at 12:52 AM, Ganesh Pal ganesh1...@gmail.com 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

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 your text

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 zachary.ware+pyl...@gmail.com wrote: On Mon, Dec 8, 2014 at 12:52 AM, Ganesh Pal ganesh1...@gmail.com wrote: Hi Folks , This