code: protected Pattern compilePattern(Element regex, int flags) {
  
  		Pattern p = null;
  		try {
  			String re = ((StringProperty) regex).getValue();
  			p = Pattern.compile(re, flags);
  		} catch (PatternSyntaxException pse) {
  			throw EvaluationException.create(sourceRange, MSG_INVALID_REGEXP,
  					pse.getLocalizedMessage());
  		}
  
  		return p;
  	}
docs: Generate a Pattern from the given string and flags.
  
  @param regex
  regular expression to compile
  @param flags
  matching flags to use for pattern
  
  @return Pattern corresponding to the given regular expression and
  matching flags