subject

In this challenge you will use the file regex_replace_challenge_student. py to: Write a regular expression that will replace all occurrences of:
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 sub() method from the re package substitute all occurrences of the 'pattern' with 'substitution'
Assign the outcome of the sub() method to a variable called replace_result
Output to the console replace_results
Regular Expression Replace Challenge
The Python statement containing the string to search for the regular expression occurrence is below. 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
The Python string below is used for substitution substitution="regular expression"
Using the sub() method from the re package substitute all occurrences of the ‘pattern’ with ‘substitution’
Assign the outcome of the sub() method to a variable called replace_result
Output to the console replace_results
import re
#The string to search for the regular expression occurrence (This is provided to the student)
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 occurrances 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
#The string to use for subsitution (This is provided to the student)
substitution="regular expression"
#3. Using the sub() method from the re package substitute all occurrences of the 'pattern' with 'substitution'
#4. Assign the outcome of the sub() method to a variable called replace_result
#5. Output to the console replace_results

ansver
Answers: 1

Another question on Computers and Technology

question
Computers and Technology, 23.06.2019 13:50
Explain how email technologies enable the exchange of messages between users. find out the typical parts of an email address and explain each part.
Answers: 1
question
Computers and Technology, 24.06.2019 05:30
Hey i really need some solving this problem: 1. encrypt this binary string into cipher text: 110000. include in your answer the formula the decoder would use to decrypt your cipher text in the format (coded answer) x n mod (m) = y & 2. decrypt this cipher text into a binary string: 106 you.
Answers: 2
question
Computers and Technology, 24.06.2019 12:40
Match the feature to the network architecture. expensive to set up useful for a small organization easy to track files has a central server inexpensive to set up difficult to track files useful for a large organization does not have a central server client- server network peer-to-peer network
Answers: 3
question
Computers and Technology, 24.06.2019 21:00
When replacing a thermostat or water pump, coolant drained from the cooling system should be
Answers: 1
You know the right answer?
In this challenge you will use the file regex_replace_challenge_student. py to: Write a regular exp...
Questions
question
Mathematics, 24.06.2019 22:00
question
Mathematics, 24.06.2019 22:00
question
History, 24.06.2019 22:00
Questions on the website: 13722363