def regexp_span_tokenize(s, regexp):
 left = 0
 for m in finditer(regexp, s):
  (right, next) = m.span()
  if (right != left):
   (yield (left, right))
  left = next
 (yield (left, len(s)))

def regexp_span_tokenize ( s , regexp ) : left = 0 for m in finditer ( regexp , s ) : ( right , next ) = m . span ( ) if ( right != left ) : ( yield ( left , right ) ) left = next ( yield ( left , len ( s ) ) )
return the offsets of the tokens in *s* .