public static String parseShowStatementSubcommand(String statement)
    {
        Matcher matcher = ShowToken.matcher(statement);
        if (matcher.matches()) {
            String commandWordTerminator = matcher.group(1);
            if (OneWhitespace.matcher(commandWordTerminator).matches()) {
                String trailings = matcher.group(3) + ";" + matcher.group(4);
                // In a valid command, both "trailings" groups should be empty.
                if (trailings.equals(";")) {
                    // Return the subcommand keyword -- possibly a valid one.
                    return matcher.group(2);
                }
                // For an invalid form of the command,
                // return an approximation of the garbage input.
                return matcher.group(2) + " " + trailings;
            }
            if (commandWordTerminator.equals("") || commandWordTerminator.equals(";")) {
                return commandWordTerminator; // EOL or ; reached before subcommand
            }
        }
        return null;
    }
public static String parseShowStatementSubcommand ( String statement ) { Matcher matcher = ShowToken . matcher ( statement ) ; if ( matcher . matches ( ) ) { String commandWordTerminator = matcher . group ( 1 ) ; if ( OneWhitespace . matcher ( commandWordTerminator ) . matches ( ) ) { String trailings = matcher . group ( 3 ) + ";" + matcher . group ( 4 ) ; if ( trailings . equals ( ";" ) ) { return matcher . group ( 2 ) ; } return matcher . group ( 2 ) + " " + trailings ; } if ( commandWordTerminator . equals ( "" ) || commandWordTerminator . equals ( ";" ) ) { return commandWordTerminator ; } } return null ; }
Parse a SHOW or LIST statement for sqlcmd.
@param statement  statement to parse
@return           String containing captured argument(s) possibly invalid,
or null if a show/list statement wasn't recognized