Re: [Pyparsing] Anchoring py.Regex
Brought to you by:
ptmcg
From: thomas_h <th...@gm...> - 2011-09-28 19:56:55
|
Any update on this? To summarize, I wonder why this (character after start-of-line, with optional intervening whitespace, in a multi-line match) py.Regex(r'^\s*B', re.M).searchString('foo\nB') matches, while this py.Regex(r'^\s*B', re.M).searchString('foo\n B') doesn't (mind the space between '\n' and 'B' in the search string), while these two ('o' before end-of-line, with optional intervening whitespace, in a multi-line match) py.Regex(r'o\s*$', re.M).searchString('foo\nB') py.Regex(r'o\s*$', re.M).searchString('foo \nB') both match (capturing the whitespace in the second case). Why do the ^ and $ anchors behave differently? Thanks, Thomas |