Regular Expressions   «Prev  Next»

Perl s Operator - Exercise

Objective: Use the s// operator and appropriate modifiers to replace one element with another in a file.

Instructions

Write a program that reads an HTML file and replaces all occurrences of the <BLINK> tag in the HTML file with the text "We do not need no stinkin' <BLINK>!" Print the results to the screen. It is not necessary to modify the HTML file itself.
Remember that there may be other text, including new lines, between the word BLINK and the ending >.
If you do not have a file handy, you can just imagine that you have a file with the <BLINK> tag in it, and write the program for your imaginary file.
Paste your code in the area below and click the Submit button when you are finished.