Given:
import java.util.regex.Matcher;
import java.util.regex.Pattern;
public class Test {
private static String REGEX = “\\Sto\\S|\\bo\\b”;
private static String INPUT = “Nice to see you,to,be fine.”;
private static String REPLACE =”,”;
public static void main(String[] args) {
Pattern p = Pattern.compile(REGEX);
Matcher m = p.matcher(INPUT);
INPUT = m.replaceAll(REPLACE);
System.out.println(INPUT);
}
}
What is the result?
A.
Nice to see you, be fine
B.
Nice, see you, be fine
C.
Nice, see you, to, be fine
D.
Nice, see you, be fine
E.
Nice to see y, u, be fine
Explanation:
The text to is removed (replaced by the empty string).
A
+1
Nice to see you,be fine.
Here are several of the websites we suggest for our visitors.
A
Nice to see you,be fine.
A