| The Java interface / Advanced programming | |
IMPORT JAVA java.util.regex.Pattern
MAIN
  DEFINE p Pattern
  LET p = Pattern.compile("a*b")
  IF p.matcher("aaaab").matches() THEN
    DISPLAY "It matches..."
  END IF
END MAIN
In this code example, the matcher() method of object p is invoked and returns an object of type java.util.regex.Matcher. The object reference returned by the matcher() method can be directly used to invoke the matches() method of the Matcher class.