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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!