I can't get the word I want with a regex query

Viewed 13

I'm trying to understand where the query starts in a create sql query. Just searching for word 'CREATE' doesn't work for me. Because before the query starts, there may be comment lines and 'CREATE' words can pass for these lines. Can anyone write a regex command that will allow me to find the word 'CREATE' where the query actually starts? Example:

--sdsdf sdfsdfsdf CREATE
/*dfgdfgfdg
CREATE
dfgd CREATE fg
dfgdfg
*/
--sadgdsgdfg CREATE
CREATE PROCEDURE PRocedure_Name AS SELECT 1

I need to be able to get the trailing word 'CREATE' in this query. Thanks everyone in advance

0 Answers
Related