Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

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

  1. 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

  2. Assign the regular expression to a variable named pattern

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

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

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

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

  1. Write a regular expression that will find all occurrences of:
    • regular expression
    • regular-expression
    • regular:expression
    • regular&expression
  2. 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
  3. Assign the regular expression to a variable named pattern
  4. 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
  5. If match1 is not None print to the console the pattern used to perform the match, followed by the word 'matched'
  6. Otherwise Print to the console the pattern used to perform the match, followed by the words 'did not match'

image text in transcribed

Chrome File Edit View History Bookmarks People Tab Window Help 72% [4) Thu 5:48 PM Q E . Module Six - IT-140-J3538 Intx C Codio - Regular Expressions x C Codio Challenge In This Challex 0 (9) Project 4 Draft Regular Exp * Take a screenshot on your Mac x + C Apps c odio.com/rroberts4/regular-expressions:5df138eb4a8fa026b45aa685:YOY5vGOTshNt/tree/challenges%2Fregex_search_challenge_student... DR DRUDGE REPORT... The official US tim... a Download Full List... NOAA's National. Codio ham radio Banking Login Registration/Login... Other Bookmarks RROBERTS OF Codio Project File Edit Find View Tools Education Help Node version - Project Index (static) regex_search... X import re #The string to search for the regular expression occurrence (This is provided to the stl Configure.... " 6. Regular Ex... X Collapse search_string='1' This is a string to search for a regular expression like regular expre regular-expression or regular expression or regular&expression #1. 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 #2. Assign the regular expression to a variable named pattern 6. Regular Expression Search Challenge In this challenge you will use the file regex_search_challenge_student.py to: 1. Write a regular expression that will find all occurrences of: o regular expression 18 #1. Using the findall() method from the re package determine if there are occurrences #. Assign the outcome of the findall() method to a variable called matchi #2. If matchi is not None: # a. Print to the console the pattern used to perform the match, followed by the wo #3. Otherwise: a. Print to the console the pattern used to perform the match, followed by the wc o regular-expression o regular:expression o 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 2. Assign the regular expression to a variable named pattern 3. Using the findall() method from the re package 48% (11:27) Python

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

More Books

Students also viewed these Databases questions

Question

6. Write a job specification.

Answered: 1 week ago

Question

3. How has e-commerce transformed marketing?

Answered: 1 week ago