July 2017
Intermediate to advanced
158 pages
3h 41m
English
We haven't yet discussed the Java API for regular expression replacement, but just for reference, it will be pertinent to discuss the syntax of a named group reference in a replacement string:
Note that the double escaping of String while defining a Java regular expression should be applied here in defining named groups, named back references, and numbered back references. Thus, repeating the previous regular expressions used in Java code:
final String regex = "^(?<num>\\d+)\\s+\\k<num>$"; ...
Read now
Unlock full access