code: public static String simpleTemplateToRegEx(String template) {
  		StringBuilder sb = new StringBuilder();
  		Matcher m = TEMPLATE_PATTERN.matcher(template);
  		int n = 0;
  		while(m.find(n)) {
  			if (m.start() != n) {
  				throw new IllegalArgumentException("Cannot tokenize [" + template + "]");
  			}
  			String match = m.group();
  			if (m.group(1) != null) {
  				sb.append(match);
  			}
  			else if (m.group(2) != null) {
  				sb.append("\\s+");
  			}
  			else if (m.group(3) != null) {
  				sb.append('\\').append(match);
  			}
  			else {
  				sb.append(match);
  			}
  			n = m.end();
  		}
  		return sb.toString();
  	}
docs: <p>
  Simple template format is less error prone in case if you want to
  make pattern from text to be matched.
  </p>
  <p>
  Template is converted to Java regular expression with following transformations:
  <li>Special characters (dots, parenthesis, asterisks, etc) are replaced by their literals</li>
  <li>Spaces are replaced with "\s+"</li>
  <li>%{...} constructs are retained</li>
  </p>