Use a compiled form of regular expressions

Compile your string regex pattern using the Pattern.compile(String) method call followed by calls to the Matcher APIs instead of calling shorthand methods in string, such as matches(), replaceAll, and replaceFirst, especially when these matching or replacement methods are invoked repeatedly inside a loop. Repeated calls to String.matches() or any other regex-based method defined in the String API will compile the String regex pattern every time; this can be very time-consuming for a complex regex pattern.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.118.152.58