$re = '/ALTER\W.*CLUSTER
ALTER\W.*DIMENSION
ALTER\W.*EXTERNAL\W.*PROCEDURE
ALTER\W.*FULLTEXT\W.*CATALOG
ALTER\W.*FULLTEXT\W.*INDEX
ALTER\W.*FUNCTION
ALTER\W.*INDEX
ALTER\W.*INDEXTYPE
ALTER\W.*LOGIN
ALTER\W.*MATERIALIZED\W.*VIEW
ALTER\W.*MATERIALIZED\W.*VIEW\W.*LOG
ALTER\W.*METHOD
ALTER\W.*NICKNAME
ALTER\W.*OPERATOR
ALTER\W.*PACKAGE
ALTER\W.*PARTITION\W.*FUNCTION
ALTER\W.*PARTITION\W.*SCHEME
ALTER\W.*PROCECURE
ALTER\W.*PROCEDURE
ALTER\W.*QUEUE
ALTER\W.*REPLICATION\W.*GROUP
ALTER\W.*ROUTINE
ALTER\W.*SEQUENCE
ALTER\W.*SERVER
ALTER\W.*SESSION
ALTER\W.*TABLE
ALTER\W.*TRIGGER
ALTER\W.*TYPE
ALTER\W.*USER\W.*MAPPING
ALTER\W.*VIEW
ALTER\W.*XML\W.*SCHEMA\W.*COLLECTION
ANALYZE
BEGIN\W.*LOGGING
BEGIN\W.*QUERY\W.*LOGGING
COLLECT\W.*DEMOGRAPHICS
COLLECT\W.*STATISTICS
COLLMOD
COMMENT
COMPACT
CREATE\W.*ALIAS
CREATE\W.*AUTHORIZATION
CREATE\W.*CAST
CREATE\W.*CLUSTER
CREATE\W.*DATABASE
CREATE\W.*DEFAULT
CREATE\W.*DIMENSION
CREATE\W.*DISTINCT\W.*TYPE
CREATE\W.*DUPLICATE
CREATE\W.*ERROR\W.*TABLE
CREATE\W.*EXISTING\W.*TABLE
CREATE\W.*EXTERNAL\W.*PROCEDURE
CREATE\W.*EXTERNAL\W.*TABLE
CREATE\W.*FULLTEXT\W.*CATALOG
CREATE\W.*FULLTEXT\W.*INDEX
CREATE\W.*FUNCTION
CREATE\W.*FUNCTION\W.*MAPPING
CREATE\W.*GLOBAL\W.*TEMPORARY\W.*TRACE\W.*TABLE
CREATE\W.*HASH\W.*INDEX
CREATE\W.*INDEX
CREATE\W.*INDEX\W.*EXTENSION
CREATE\W.*JOIN\W.*INDEX
CREATE\W.*LIBRARY
CREATE\W.*LOGIN
CREATE\W.*MACRO
CREATE\W.*MATERIALIZED\W.*VIEW
CREATE\W.*MATERIALIZED\W.*VIEW\W.*LOG
CREATE\W.*METHOD
CREATE\W.*NICKNAME
CREATE\W.*OPERATOR
CREATE\W.*OR\W.*REPLACE\W.*FUNCTION
CREATE\W.*OR\W.*REPLACE\W.*PROCEDURE
CREATE\W.*OR\W.*REPLACE\W.*TRIGGER
CREATE\W.*OR\W.*REPLACE\W.*VIEW
CREATE\W.*ORDERING
CREATE\W.*PACKAGE
CREATE\W.*PACKAGE\W.*BODY
CREATE\W.*PARATITION\W.*SCHEME
CREATE\W.*PARTITION\W.*FUNCTION
CREATE\W.*PROCEDURE
CREATE\W.*PROFILE
CREATE\W.*PROXY_TABLE
CREATE\W.*PUBLIC\W.*SYNONYM
CREATE\W.*RECURSIVE\W.*VIEW
CREATE\W.*REPLICATION\W.*GROUP
CREATE\W.*ROLE
CREATE\W.*ROUTINE\W.*FROM
CREATE\W.*RULE
CREATE\W.*SCHEMA
CREATE\W.*SEQUENCE
CREATE\W.*SESSION
CREATE\W.*SYNONYM
CREATE\W.*TABLE
CREATE\W.*TRANSFORM
CREATE\W.*TRIGGER
CREATE\W.*TYPE
CREATE\W.*TYPE\W.*BODY
CREATE\W.*TYPE\W.*MAPPING
CREATE\W.*USER
CREATE\W.*VIEW
CREATE\W.*XML\W.*SCHEMA\W.*COLLECTION
DATABASE
DELETE\W.*DATABASE
DELETE\W.*STATISTICS
DELETE\W.*USER
DESCRIBE
DIAGNOSTIC\W.*"VALIDATE\W.*INDEX"
DIAGNOSTIC\W.*COSTPRINT
DIAGNOSTIC\W.*DUMP\W.*COSTS
DIAGNOSTIC\W.*DUMP\W.*SAMPLES
DIAGNOSTIC\W.*HELP\W.*COSTS
DIAGNOSTIC\W.*HELP\W.*PROFILE
DIAGNOSTIC\W.*HELP\W.*SAMPLES
DIAGNOSTIC\W.*SET\W.*COSTS
DIAGNOSTIC\W.*SET\W.*PROFILE
DIAGNOSTIC\W.*SET\W.*SAMPLES
DROP
DROP\W.*ALIAS
DROP\W.*AUTHORIZATION
DROP\W.*CAST
DROP\W.*CLUSTER
DROP\W.*DATABASE
DROP\W.*DEFAULT
DROP\W.*DIMENSION
DROP\W.*DUPLICATE
DROP\W.*ERROR\W.*TABLE
DROP\W.*FULLTEXT\W.*CATALOG
DROP\W.*FULLTEXT\W.*INDEX
DROP\W.*FUNCTION
DROP\W.*FUNCTION\W.*MAPPING
DROP\W.*HASH\W.*INDEX
DROP\W.*INDEX
DROP\W.*INDEX\W.*EXTENSION
DROP\W.*JOIN\W.*INDEX
DROP\W.*LIBRARY
DROP\W.*LOGIN
DROP\W.*MACRO
DROP\W.*MATERIALIZED\W.*VIEW
DROP\W.*MATERIALIZED\W.*VIEW\W.*LOG
DROP\W.*NICKNAME
DROP\W.*OPERATOR
DROP\W.*ORDERING
DROP\W.*OUTLINE
DROP\W.*PACKAGE
DROP\W.*PARTITION\W.*FUNCTION
DROP\W.*PARTITION\W.*SCHEME
DROP\W.*PROCEDURE
DROP\W.*PROFILE
DROP\W.*PUBLIC\W.*SYNONYM
DROP\W.*REPLICATION\W.*GROUP
DROP\W.*ROLE
DROP\W.*ROUTINE
DROP\W.*RULE
DROP\W.*SEQUENCE
DROP\W.*SESSION
DROP\W.*STATISTICS
DROP\W.*SYNONYM
DROP\W.*TABLE
DROP\W.*TRANSFORM
DROP\W.*TRIGGER
DROP\W.*TYPE
DROP\W.*TYPE\W.*BODY
DROP\W.*TYPE\W.*MAPPING
DROP\W.*USER
DROP\W.*VIEW
DROP\W.*VIEW\W.*HIERARCHY
DROP\W.*XML\W.*SCHEMA\W.*COLLECTION
DUMP\W.*EXPLAIN
EMPTYCAPPED
END\W.*LOGGING
END\W.*QUERY\W.*LOGGING
GIVE
GRANT
GRANT\W.*LOGON
HELP
HELP\W.*CAST
HELP\W.*COLUMN
HELP\W.*CONSTRAINT
HELP\W.*DATABASE
HELP\W.*ERROR\W.*TABLE
HELP\W.*FUNCTION
HELP\W.*HASH\W.*INDEX
HELP\W.*INDEX
HELP\W.*JOIN\W.*INDEX
HELP\W.*MACRO
HELP\W.*METHOD
HELP\W.*PROCEDURE
HELP\W.*REPLICATION\W.*GROUP
HELP\W.*SESSION
HELP\W.*STATISTICS
HELP\W.*TABLE
HELP\W.*TRANSFORM
HELP\W.*TRIGGER
HELP\W.*TYPE
HELP\W.*USER
HELP\W.*VIEW
HELP\W.*VOLATILE\W.*TABLE
INITIATE\W.*INDEX\W.*ANALYSIS
INSERT\W.*EXPLAIN
LOCK\W.*TABLE
LOGGING\W.*ONLINE\W.*ARCHIVE\W.*OFF
LOGGING\W.*ONLINE\W.*ARCHIVE\W.*ON
MODIFY\W.*DATABASE
MODIFY\W.*PROFILE
MODIFY\W.*USER
MOVE\W.*TABLE
REMOVE\W.*JAVA
RENAME
RENAME\W.*COLUMN
RENAME\W.*FUNCTION
RENAME\W.*INDEX
RENAME\W.*MACRO
RENAME\W.*PROCEDURE
RENAME\W.*SEQUENCE
RENAME\W.*TABLE
RENAME\W.*TRIGGER
RENAME\W.*VIEW
RENAMECOLLECTION
REORG
REPLACE\W.*AUTHORIZATION
REPLACE\W.*CAST
REPLACE\W.*FUNCTION
REPLACE\W.*MACRO
REPLACE\W.*METHOD
REPLACE\W.*ORDERING
REPLACE\W.*PROCEDURE
REPLACE\W.*RECURSIVE\W.*VIEW
REPLACE\W.*TRANSFORM
REPLACE\W.*TRIGGER
REPLACE\W.*VIEW
RESTART\W.*INDEX\W.*ANALYSIS
REVOKE
REVOKE\W.*LOGON
SET\W.*ENCRYPTION\W.*PASSWORD
SET\W.*QUERY_BAND
SET\W.*ROLE
SET\W.*SESSION
SET\W.*TIME\W.*ZONE
SHOW\W.*CAST
SHOW\W.*ERROR\W.*TABLE
SHOW\W.*FUNCTION
SHOW\W.*HASH\W.*INDEX
SHOW\W.*JOIN\W.*INDEX
SHOW\W.*MACRO
SHOW\W.*METHOD
SHOW\W.*PROCEDURE
SHOW\W.*REPLICATION\W.*GROUP
SHOW\W.*TABLE
SHOW\W.*TRIGGER
SHOW\W.*TYPE
SHOW\W.*VIEW
TRUNCATE\W.*TABLE
UPDATE\W.*DIMENSION\W.*MEMBER/m';
$str = 'ALTER CLUSTER
ALTER DIMENSION
ALTER EXTERNAL PROCEDURE
ALTER FULLTEXT CATALOG
ALTER FULLTEXT INDEX
ALTER FUNCTION
ALTER INDEX
ALTER INDEXTYPE
ALTER LOGIN
ALTER MATERIALIZED VIEW
ALTER MATERIALIZED VIEW LOG
ALTER METHOD
ALTER NICKNAME
ALTER OPERATOR
ALTER PACKAGE
ALTER PARTITION FUNCTION
ALTER PARTITION SCHEME
ALTER PROCECURE
ALTER PROCEDURE
ALTER QUEUE
ALTER REPLICATION GROUP
ALTER ROUTINE
ALTER SEQUENCE
ALTER SERVER
ALTER SESSION
ALTER TABLE
ALTER TRIGGER
ALTER TYPE
ALTER USER MAPPING
ALTER VIEW
ALTER XML SCHEMA COLLECTION
ANALYZE
BEGIN LOGGING
BEGIN QUERY LOGGING
COLLECT DEMOGRAPHICS
COLLECT STATISTICS
COLLMOD
COMMENT
COMPACT
CREATE ALIAS
CREATE AUTHORIZATION
CREATE CAST
CREATE CLUSTER
CREATE DATABASE
CREATE DEFAULT
CREATE DIMENSION
CREATE DISTINCT TYPE
CREATE DUPLICATE
CREATE ERROR TABLE
CREATE EXISTING TABLE
CREATE EXTERNAL PROCEDURE
CREATE EXTERNAL TABLE
CREATE FULLTEXT CATALOG
CREATE FULLTEXT INDEX
CREATE FUNCTION
CREATE FUNCTION MAPPING
CREATE GLOBAL TEMPORARY TRACE TABLE
CREATE HASH INDEX
CREATE INDEX
CREATE INDEX EXTENSION
CREATE JOIN INDEX
CREATE LIBRARY
CREATE LOGIN
CREATE MACRO
CREATE MATERIALIZED VIEW
CREATE MATERIALIZED VIEW LOG
CREATE METHOD
CREATE NICKNAME
CREATE OPERATOR
CREATE OR REPLACE FUNCTION
CREATE OR REPLACE PROCEDURE
CREATE OR REPLACE TRIGGER
CREATE OR REPLACE VIEW
CREATE ORDERING
CREATE PACKAGE
CREATE PACKAGE BODY
CREATE PARATITION SCHEME
CREATE PARTITION FUNCTION
CREATE PROCEDURE
CREATE PROFILE
CREATE PROXY_TABLE
CREATE PUBLIC SYNONYM
CREATE RECURSIVE VIEW
CREATE REPLICATION GROUP
CREATE ROLE
CREATE ROUTINE FROM
CREATE RULE
CREATE SCHEMA
CREATE SEQUENCE
CREATE SESSION
CREATE SYNONYM
CREATE TABLE
CREATE TRANSFORM
CREATE TRIGGER
CREATE TYPE
CREATE TYPE BODY
CREATE TYPE MAPPING
CREATE USER
CREATE VIEW
CREATE XML SCHEMA COLLECTION
DATABASE
DELETE DATABASE
DELETE STATISTICS
DELETE USER
DESCRIBE
DIAGNOSTIC "VALIDATE INDEX"
DIAGNOSTIC COSTPRINT
DIAGNOSTIC DUMP COSTS
DIAGNOSTIC DUMP SAMPLES
DIAGNOSTIC HELP COSTS
DIAGNOSTIC HELP PROFILE
DIAGNOSTIC HELP SAMPLES
DIAGNOSTIC SET COSTS
DIAGNOSTIC SET PROFILE
DIAGNOSTIC SET SAMPLES
DROP
DROP ALIAS
DROP AUTHORIZATION
DROP CAST
DROP CLUSTER
DROP DATABASE
DROP DEFAULT
DROP DIMENSION
DROP DUPLICATE
DROP ERROR TABLE
DROP FULLTEXT CATALOG
DROP FULLTEXT INDEX
DROP FUNCTION
DROP FUNCTION MAPPING
DROP HASH INDEX
DROP INDEX
DROP INDEX EXTENSION
DROP JOIN INDEX
DROP LIBRARY
DROP LOGIN
DROP MACRO
DROP MATERIALIZED VIEW
DROP MATERIALIZED VIEW LOG
DROP NICKNAME
DROP OPERATOR
DROP ORDERING
DROP OUTLINE
DROP PACKAGE
DROP PARTITION FUNCTION
DROP PARTITION SCHEME
DROP PROCEDURE
DROP PROFILE
DROP PUBLIC SYNONYM
DROP REPLICATION GROUP
DROP ROLE
DROP ROUTINE
DROP RULE
DROP SEQUENCE
DROP SESSION
DROP STATISTICS
DROP SYNONYM
DROP TABLE
DROP TRANSFORM
DROP TRIGGER
DROP TYPE
DROP TYPE BODY
DROP TYPE MAPPING
DROP USER
DROP VIEW
DROP VIEW HIERARCHY
DROP XML SCHEMA COLLECTION
DUMP EXPLAIN
EMPTYCAPPED
END LOGGING
END QUERY LOGGING
GIVE
GRANT
GRANT LOGON
HELP
HELP CAST
HELP COLUMN
HELP CONSTRAINT
HELP DATABASE
HELP ERROR TABLE
HELP FUNCTION
HELP HASH INDEX
HELP INDEX
HELP JOIN INDEX
HELP MACRO
HELP METHOD
HELP PROCEDURE
HELP REPLICATION GROUP
HELP SESSION
HELP STATISTICS
HELP TABLE
HELP TRANSFORM
HELP TRIGGER
HELP TYPE
HELP USER
HELP VIEW
HELP VOLATILE TABLE
INITIATE INDEX ANALYSIS
INSERT EXPLAIN
LOCK TABLE
LOGGING ONLINE ARCHIVE OFF
LOGGING ONLINE ARCHIVE ON
MODIFY DATABASE
MODIFY PROFILE
MODIFY USER
MOVE TABLE
REMOVE JAVA
RENAME
RENAME COLUMN
RENAME FUNCTION
RENAME INDEX
RENAME MACRO
RENAME PROCEDURE
RENAME SEQUENCE
RENAME TABLE
RENAME TRIGGER
RENAME VIEW
RENAMECOLLECTION
REORG
REPLACE AUTHORIZATION
REPLACE CAST
REPLACE FUNCTION
REPLACE MACRO
REPLACE METHOD
REPLACE ORDERING
REPLACE PROCEDURE
REPLACE RECURSIVE VIEW
REPLACE TRANSFORM
REPLACE TRIGGER
REPLACE VIEW
RESTART INDEX ANALYSIS
REVOKE
REVOKE LOGON
SET ENCRYPTION PASSWORD
SET QUERY_BAND
SET ROLE
SET SESSION
SET TIME ZONE
SHOW CAST
SHOW ERROR TABLE
SHOW FUNCTION
SHOW HASH INDEX
SHOW JOIN INDEX
SHOW MACRO
SHOW METHOD
SHOW PROCEDURE
SHOW REPLICATION GROUP
SHOW TABLE
SHOW TRIGGER
SHOW TYPE
SHOW VIEW
TRUNCATE TABLE
UPDATE DIMENSION MEMBER';
preg_match_all($re, $str, $matches, PREG_SET_ORDER, 0);
// Print the entire match result
var_dump($matches);
Please keep in mind that these code samples are automatically generated and are not guaranteed to work. If you find any syntax errors, feel free to submit a bug report. For a full regex reference for PHP, please visit: http://php.net/manual/en/ref.pcre.php