Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Seven NoSQL Databases In A Week Get Up And Running With The Fundamentals And Functionalities Of Seven Of The Most Popular NoSQL Databases

Authors: Aaron Ploetz ,Devram Kandhare ,Sudarshan Kadambi ,Xun Wu

1st Edition

1787288862, 978-1787288867

More Books

Students also viewed these Databases questions

Question

1. How will you, as city manager, handle these requests?

Answered: 1 week ago

Question

1. Identify the sources for this conflict.

Answered: 1 week ago

Question

3. How would you address the problems that make up the situation?

Answered: 1 week ago