"""Return an iterator over all non-overlapping matches for the RE pattern in string.
For each match, the iterator returns a match object."""
# this also works as the implementation of the undocumented
# scanner() method.
ctx=self.make_ctx(w_string,pos,endpos)
...
...
@@ -352,6 +361,7 @@ class W_SRE_Pattern(W_Root):
@unwrap_spec(maxsplit=int)
defsplit_w(self,w_string,maxsplit=0):
"""Split string by the occurrences of pattern."""
space=self.space
#
splitlist=[]
...
...
@@ -381,11 +391,13 @@ class W_SRE_Pattern(W_Root):
@unwrap_spec(count=int)
defsub_w(self,w_repl,w_string,count=0):
"""Return the string obtained by replacing the leftmost non-overlapping occurrences of pattern in string by the replacement repl."""
w_item,n=self.subx(w_repl,w_string,count)
returnw_item
@unwrap_spec(count=int)
defsubn_w(self,w_repl,w_string,count=0):
"""Return the tuple (new_string, number_of_subs_made) found by replacing the leftmost non-overlapping occurrences of pattern with the replacement repl."""