Question: Write a Java program to replace each substring of a given string that matches a regular expression with the specific replacement. Sample string : The

Write a Java program to replace each substring of a given string that matches a regular expression with the specific replacement.

Sample string : "The quick brown fox jumps over the lazy dog."

In the above string replace all the fox with cat.

Sample Output:

Original string: The quick brown fox jumps over the lazy dog.

New String: The quick brown cat jumps over the lazy dog.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock 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 Databases Questions!