Community
Participate
Working Groups
I wanted to create an ECL procedure to match a regular expression and return the contents of a given match group. This is what I came up with: proc "regex-group" [val text -input] [val regex] [val groupNumber] { with [invoke-static "de.dsa.base.bi.core" "java.util.regex.Pattern" compile $regex | invoke matcher $text] { invoke find invoke group $groupNumber } } Then I call something like: regex-group "AB123BA" "\w+(\d+)\w+" 1 Unfortunately this doesn't work at runtime: > Do not know how to box value of type 'java.util.regex.Matcher' I haven't found a way to call find() and group(int) on the same Matcher object via ECL reflection. It would be nice if RCPTT had a general-purpose mechanism to box arbitrary Java objects. The only thing I'd like to do with it is call "invoke" on it.