SpringELTry { public boolean matchExpression2() { ExpressionParser parser = new SpelExpressionParser(); String s = "-DevIP=116.1.239.33; Line protocol on the interface GigabitEthernet1/0/3 is DOWN."; String regular = ".*is DOWN."; System.out.println("aim:\t\t" + s + " \r\nregular:\t" + regular); Expression expression = parser.parseExpression(String.format("'%s' matches '%s'", s, regular)); return expression.getValue(Boolean.class); }  String hello(); boolean matchExpression(); boolean matchExpression2();  }
@Test public void testRegular2() throws Exception { assertTrue(springELTry.matchExpression2()); }