private void finalizeRePattern ( String name , String rePattern ) { // create correct regular expression rePattern = rePattern . replaceFirst ( "\\|" , "" ) ; /* this was added to reduce the danger of getting unusable groups from user-made repattern * files with group-producing parentheses (i.e. "(foo|bar)" while matching against the documents. */ rePattern = rePattern . replaceAll ( "\\(([^\\?])" , "(?:$1" ) ; rePattern = "(" + rePattern + ")" ; rePattern = rePattern . replaceAll ( "\\\\" , "\\\\\\\\" ) ; // add rePattern to hmAllRePattern hmAllRePattern . put ( name , rePattern ) ; }
Pattern containing regular expression is finalized i . e . created correctly and added to hmAllRePattern .