Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Can someone code this is Python 3 or Codio please. 6. Regular Expression Search Challenge In this challenge you will use the file regex_search_challenge_student.py to:

Can someone code this is Python 3 or Codio please.

6. Regular Expression Search Challenge

In this challenge you will use the file regex_search_challenge_student.py to:

Regular Expression Search Challenge

Using the Python string below to perform a search using a regular expression that you create.

search_string=This is a string to search for a regular expression like regular expression or regular-expression or regular:expression or regular&expression

Write a regular expression that will find all occurrences of: a. regular expression b. regular-expression c. regular:expression d. regular&expression in search_string

Assign the regular expression to a variable named pattern

Using the findall() method from the re package determine if there are occurrences in search_string

Assign the outcome of the findall() method to a variable called match1

If match1 is not None: a. Print to the console the pattern used to perform the match, followed by the word matched

Otherwise: a. Print to the console the pattern used to perform the match, followed by the words did not match

Check It!

LAST RUN on ?2?/?26?/?2018? ?1?:?11?:?41? ?PM

 

Check 1 failed

Write a regular expression that will find all occurrences of:

regular expression

regular-expression

regular:expression

regular&expression

In the string: This is a string to search for a regular expression like regular expression or regular-expression or regular:expression or regular&expression

Assign the regular expression to a variable named pattern

Using the findall() method from the re package determine if there are occurrences in `search_string`

Assign the outcome of the findall() method to a variable called match1

If match1 is not None print to the console the pattern used to perform the match, followed by the word 'matched'

Otherwise Print to the console the pattern used to perform the match, followed by the words 'did not match'

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

Professional Microsoft SQL Server 2014 Administration

Authors: Adam Jorgensen, Bradley Ball

1st Edition

111885926X, 9781118859261

More Books

Students also viewed these Databases questions

Question

=+Understand the fi eld of comparative IHRM.

Answered: 1 week ago

Question

=+j Understand different types of regions in the world.

Answered: 1 week ago