python string that extracts sections of the string based
#regex string
#combines the functionalities of a string in a regex
class RegexStr:
def __init__(self, string):
self.string = string
def __repr__(self):
return self.string
#special getitem method that returns the first match
def __getitem__(self, i):
import re
return re.search(i, self.string).group(0)