question: static String convertPattern ( String pattern ) { if ( ! pattern . contains ( "{" ) ) { return pattern ; } else { return pattern . replaceAll ( "(\\A|\\G|[^\\\\]|\\\\\\\\)[{]([0-9]+)[}]" , "$1\\\\$2" ) ; } }
target:  Convert a pattern from the input format, with {N} for captured groups, to the \N format used by Java regexps. 