I am trying to create a RegEx to get the database, schema and table names from an SQL CREATE TABLE statement:
Example 1:
CREATE TABLE "finance"."invoices_1" (
"abc" NUMBER(15,0),
"def" VARCHAR2(200),
"ghi" DATE
);
Example 2:
CREATE TABLE "commerce"."finance"."invoices_1" (
"abc" NUMBER(15,0),
"def" VARCHAR2(200),
"ghi" DATE
);
The depth of the schema varies, so I'm trying to come up with a regular experession that match the names, whether they include the database name, schema name or only the table name:
\"[A-Za-z0-9_]*\"
Unfortunately, this also matches the column names. Is there a way to match this specific pattern only up until the first opening bracket?