Question: Goal: To complete some methods that utilise simple regular expressions to process and validate different string formats. Please see Lecture 4 , slides 4 3
Goal: To complete some methods that utilise simple regular expressions to process and
validate different string formats. Please see Lecture slides for details on regular
expressions regex
Please refer to the API for laband the comments within the Questionjava file for
more information on the operation of each method and hints
There are two methods to complete for this question.
In the first, we will use a regex expression and a suitable replacebased method from the
String class to match and replace all digits in an input string text with the corresponding
String mask both provided as arguments to the method. The result should be the new
version of the string, which should be returned from the method.
public String replaceAllNumbersString text, String mask
Examples:
replaceAllNumbers## # #
replaceAllNumbersI am years old", "I am years old"
replaceAllNumbersI live at Main St
"I live at Main St
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
