Useful scripts
Javascript vs Groovy
Scripts provided here are typically Javascript so will likely not work if directly pasted into a Groovy script editor, some tweaking may be required.
Groovy: getting a Regexp Pattern Class:
import java.util.regex.Pattern;
def pattern = Pattern.compile("([Gg])roovy")
assert pattern.class == Pattern;
print('pattern class: '+pattern.class);
Example Scripts
The following are scripts to solve some cases, may help you toward a solution, feel free to submit yours through support or comments!