private boolean matches(Pattern regexp) {
        Matcher m = regexp.matcher(script);
        m.region(offset, script.length());
        if (m.lookingAt()) {
            currentMatch = m.group();
            offset = m.end();
            return true;
        } else {
            currentMatch = "";
            return false;
        }
    }
Rough lexical parser for SQL scripts.
modules/database-commons/src/main/java/org/testcontainers/ext/ScriptScanner.java