Closed dmutti closed 10 years ago
public static void main(String[] args) throws Exception {
ScriptEngineManager factory = new ScriptEngineManager();
ScriptEngine engine = factory.getEngineByName("JavaScript");
engine.put("regexp", "/[a-zA-Z0-9]+/");
engine.put("input", "a");
engine.eval("var patt = eval(regexp); var result = patt.test(input);");
System.out.println(engine.get("result"));
}
Done!
http://groovy.codehaus.org/Regular+Expressions http://docs.ruby-lang.org/en/trunk/Regexp.html http://www.w3schools.com/js/js_regexp.asp