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
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
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
On Tuesday 28 September 2010, it occurred to Florian Kaufmann to exclaim:
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
On 28/09/2010 09:10, Florian Kaufmann wrote:
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
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
On 28/09/2010 17:32, Florian Kaufmann wrote:
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