View Single Post
Old 01-11-2026, 06:55 PM   #9
jwes
Connoisseur
jwes began at the beginning.
 
Posts: 96
Karma: 10
Join Date: Jul 2023
Device: none
Quote:
Originally Posted by KevinH View Post
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
jwes is offline   Reply With Quote