The Groovy script works on the Matcher instance that is passed to the script in the variable matcher. The script must have a single return value of type hudson.plugins.warnings.parser.Warning.
Here is an example that you can use as a starting point for your script. It composes a new warning using the matcher of the regular expression ^\s*(.*):(\d+):(.*):\s*(.*)$.
import hudson.plugins.warnings.parser.Warning String fileName = matcher.group(1) String lineNumber = matcher.group(2) String category = matcher.group(3) String message = matcher.group(4) return new Warning(fileName, Integer.parseInt(lineNumber), "Dynamic Parser", category, message);