private String createRegexFromRule(String urlRuleText){
  String regexText=StringUtils.replaceEach(urlRuleText,new String[]{"?",".","+","[","]","(",")","{","}","#"," ","\\","$"},new String[]{"\\?","\\.","\\+","\\[","\\]","\\(","\\)","\\{","\\}","\\#","\\ ","\\\\","\\$"});
  regexText=regexText.substring(0,MASK_START_URL.length()) + StringUtils.replace(regexText.substring(MASK_START_URL.length(),regexText.length() - 1),"|","\\|") + regexText.substring(regexText.length() - 1);
  regexText=StringUtils.replace(regexText,MASK_ANY_SYMBOL,REGEXP_ANY_SYMBOL);
  regexText=StringUtils.replace(regexText,MASK_SEPARATOR,REGEXP_SEPARATOR);
  if (regexText.startsWith(MASK_START_URL)) {
    regexText=REGEXP_START_URL + regexText.substring(MASK_START_URL.length());
  }
 else   if (regexText.startsWith(MASK_PIPE)) {
    regexText=REGEXP_START_STRING + regexText.substring(MASK_PIPE.length());
  }
  if (regexText.endsWith(MASK_PIPE)) {
    regexText=regexText.substring(0,regexText.length() - 1) + REGEXP_END_STRING;
  }
  return regexText;
}

private String createRegexFromRule ( String urlRuleText ) { String regexText = StringUtils . replaceEach ( urlRuleText , new String [ ] { "?" , "." , "+" , "[" , "]" , "(" , ")" , "{" , "}" , "#" , " " , "\\" , "$" } , new String [ ] { "\\?" , "\\." , "\\+" , "\\[" , "\\]" , "\\(" , "\\)" , "\\{" , "\\}" , "\\#" , "\\ " , "\\\\" , "\\$" } ) ; regexText = regexText . substring ( 0 , MASK_START_URL . length ( ) ) + StringUtils . replace ( regexText . substring ( MASK_START_URL . length ( ) , regexText . length ( ) - 1 ) , "|" , "\\|" ) + regexText . substring ( regexText . length ( ) - 1 ) ; regexText = StringUtils . replace ( regexText , MASK_ANY_SYMBOL , REGEXP_ANY_SYMBOL ) ; regexText = StringUtils . replace ( regexText , MASK_SEPARATOR , REGEXP_SEPARATOR ) ; if ( regexText . startsWith ( MASK_START_URL ) ) { regexText = REGEXP_START_URL + regexText . substring ( MASK_START_URL . length ( ) ) ; } else if ( regexText . startsWith ( MASK_PIPE ) ) { regexText = REGEXP_START_STRING + regexText . substring ( MASK_PIPE . length ( ) ) ; } if ( regexText . endsWith ( MASK_PIPE ) ) { regexText = regexText . substring ( 0 , regexText . length ( ) - 1 ) + REGEXP_END_STRING ; } return regexText ; }
creates regexp from url rule text
