public FEELFnResult<Boolean> invoke(@ParameterName("input") String input, @ParameterName("pattern") String pattern, @ParameterName("flags") String flags) { if ( input == null ) { return FEELFnResult.ofError( new InvalidParametersEvent( Severity.ERROR, "input", "cannot be null" ) ); } if ( pattern == null ) { return FEELFnResult.ofError( new InvalidParametersEvent( Severity.ERROR, "pattern", "cannot be null" ) ); } try { int f = processFlags( flags ); Pattern p = Pattern.compile( pattern, f ); Matcher m = p.matcher( input ); return FEELFnResult.ofResult( m.find() ); } catch ( PatternSyntaxException e ) { return FEELFnResult.ofError( new InvalidParametersEvent( Severity.ERROR, "pattern", "is invalid and can not be compiled", e ) ); } catch ( IllegalArgumentException t ) { return FEELFnResult.ofError( new InvalidParametersEvent( Severity.ERROR, "flags", "contains unknown flags", t ) ); } catch ( Throwable t) { return FEELFnResult.ofError( new InvalidParametersEvent( Severity.ERROR, "pattern", "is invalid and can not be compiled", t ) ); } }