Question: Write a regular expression that finds all of the occurrences of the word a in the following sentence and replaces them with the: a dog

Write a regular expression that finds all of the occurrences of the word “a” in the following sentence and replaces them with “the”: “a dog walked in off a street and ordered a finest beer” The sentence should become: “the dog walked in off the street and ordered the finest beer”

Step by Step Solution

3.52 Rating (162 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

With regular expressions its often not just what you want to match but also what you dont ... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Beginning JavaScript Questions!