Question
Python Language. Making a Regex. Describe some task that you might want to complete with a regex and create a regex to do it. With
Python Language.
Making a Regex.
Describe some task that you might want to complete with a regex and create a regex to do it. With that, post both the task and your regex and what you think it will match and won't match. But it doesn't have to be super complex but it does have to match more than one string.
Example of a Regex-
class WatchListLinked:
def __init__(self, fname=""):
self.root = Node()
self.root.children = [Node('5'), Node('10'), Node('20'),
Node('50'), Node('100')]
if fname:
with open(fname) as fp:
for line in fp:
serial_number, denomination = line.split()
self.insert(serial_number, denomination)
self.validator = re.compile(r'^[A-M][A-L](?!0{8})\d{8}[A-NP-Y]$')
class WatchListDict:
def __init__(self, fname=""):
self.root = {'5': {}, '10': {}, '20': {}, '50': {}, '100': {}}
if fname:
file = open(fname, 'r')
for line in file:
serial_number, denomination = line.split()
self.insert(serial_number, denomination)
self.validator = re.compile(r'^[A-M][A-L](?!0{8})\d{8}[A-NP-Y]$')
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started