Quote:
Originally Posted by KevinH
Please give that a try and let me know how it goes.
|
Still nothing. Here is the changed function:
Code:
class SigilMatch(object):
def __init__(self, text, groupslist):
self.string = text
self.groupslist = groupslist
self.mtchbeg, self.mtchend = groupslist[0]
def start(self):
return self.mtchbeg
def end(self):
return self.mtchend
def span(self, i):
if i < 0 or i >= len(self.groupslist):
raise IndexError("match group index not valid");
return self.groupslist[i][0], self.groupslist[i][1]
def group(self, i=0):
if i < 0 or i >= len(self.groupslist):
raise IndexError("match group index not valid");
return self.string[self.groupslist[i][0] : self.groupslist[i][1]]
def groups(self):
results = []
for i, v in enumerate(self.groupslist):
if i > 0:
results.append(self.string[v[0]: v[1]])
return results