public static CustomFormat createInstance(String pattern,Map<String,String> regexMap){
  CustomFormat format=new CustomFormat();
  format.m_nameList=extractNames(pattern);
  format.m_nameSet=new HashSet<String>(format.m_nameList);
  format.m_pattern=pattern;
  Map<String,String> varMap=new HashMap<String,String>();
  for (  String name : format.m_nameSet) {
    String regex=String.format("(%s)",regexMap.containsKey(name) ? regexMap.get(name) : VALUE_REGEX);
    varMap.put(name,regex);
  }
  format.m_regex=StrSubstitutor.replace(pattern,varMap);
  return format;
}

public static CustomFormat createInstance ( String pattern , Map < String , String > regexMap ) { CustomFormat format = new CustomFormat ( ) ; format . m_nameList = extractNames ( pattern ) ; format . m_nameSet = new HashSet < String > ( format . m_nameList ) ; format . m_pattern = pattern ; Map < String , String > varMap = new HashMap < String , String > ( ) ; for ( String name : format . m_nameSet ) { String regex = String . format ( "(%s)" , regexMap . containsKey ( name ) ? regexMap . get ( name ) : VALUE_REGEX ) ; varMap . put ( name , regex ) ; } format . m_regex = StrSubstitutor . replace ( pattern , varMap ) ; return format ; }
create a customformat with custom regular expressions for some variables
