Re: How to match where the search started?

2010-09-28 Thread Florian Kaufmann
> If you want to anchor the regex at the start position 'pos' then use > the 'match' method instead. The wickedly problem is that matching at position 'pos' is not a requirement, its an option. Look again at my 2nd example, the r'(\=|.)...' part, which (of course wrongly) assumes that \= means 'ma

Re: How to match where the search started?

2010-09-28 Thread Florian Kaufmann
The thing is that the (\=|...) group is not really part of the match. I think this gives you more the idea what I want reo = re.compile( r'(\=|.)...' ); while True mo = reo.search(text,pos) if not mo: break if text[mo.start()] == '\\' # a pseudo match. continue after the backslash else

Re: How to match where the search started?

2010-09-28 Thread Florian Kaufmann
The thing is that the (\=|...) group is not really part of the match. I think this gives you more the idea what I want reo = re.compile( r'(\=|.)...' ); while True mo = reo.search(text,pos) if not mo: break if text[mo.start()] == '\\' # a pseudo match. continue after the backslash else

How to match where the search started?

2010-09-28 Thread Florian Kaufmann
>From the documentation: 7.2.4. Regular Expression Objects, search(string[, pos[, endpos]]) ... the '^' pattern character matches at the real beginning of the string and at positions just after a newline, but not necessarily at the index where the search is to start But I'd like to do just th