private boolean matchesQuotedString(final char quote) {
        if (script.charAt(offset) == quote) {
            boolean escaped = false;
            for (int i = offset + 1; i < script.length(); i++) {
                char c = script.charAt(i);
                if (escaped) {
                    //just skip the escaped character and drop the flag
                    escaped = false;
                } else if (c == '\\') {
                    escaped = true;
                } else if (c == quote) {
                    currentMatch = script.substring(offset, i + 1);
                    offset = i + 1;
                    return true;
                }
            }
        }
        return false;
    }
Rough lexical parser for SQL scripts.
modules/database-commons/src/main/java/org/testcontainers/ext/ScriptScanner.java