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
Get step-by-step solutions from verified subject matter experts
