On May 18, 6:50 am, James Stroud <[EMAIL PROTECTED]> wrote:

> def guarded_search(rgx, astring, escaped):
>    m = re.search(rgx, astring)
>    if m:
>      s = m.start()
>      e = m.end()
>      for i in escaped:
>        if s <= i <= e:

Did you mean to write

if s <= i < e:

?


>          m = None
>          break
>    return m
>

Your guarded search fails if there is a match after the rightmost bad
position i.e. it gives up at the first bad position.

My "guarded_search" (see separated post) needs the following done to
it:
1. make a copy
2. change name of copy to "guarded_searchall" or something similar
3. change "yield" to "return" in the original

Cheers,
John

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to