What is the importance of Pattern.compile()
method?
Why do I need to compile the regex string before getting the Matcher
object?
For example :
String regex = "((\\S+)\\s*some\\s*";
Pattern pattern = Pattern.compile(regex); // why do I need to compile
Matcher matcher = pattern.matcher(text);