I am trying to use Matcher to replace some text using a regex, but ST is telling me: java.lang.SecurityException: Invoking methods on class java.util.regex.Matcher is not allowed. Can we not do regex? Seems like something well suited to writing our own devicetypes.
1 Like
@Ben are we able to get this function enabled?
It seems crazy to be able to run a match - but not actually check if it has worked.
Example:
def myRegularExpression = /zw device: [0-9]+, command: 2001, payload: ([0-9]+)/
def matcher = ( evt =~ myRegularExpression )
if ( matcher.matches() ) {
log.debug "match"
}
The above works, and extracts the payload - but I can’t use the function .matches() to see if it has anything for me.
Did anyone figure out how to find out how many entries exist in such a regex and then extract them?