I'm trying to find if a gived SQL statement is create table/temp table statements.
import re
sql = '\nCREATE TABLE tabename \nAS\nSELECT 1'
rgxddl = re.compile(r"(create\s+(?:table|or\s+replace\s+table|temp\s+table)\s+[\s\S]*)",re.MULTILINE|re.IGNORECASE)
m = rgxddl.match(sql)
m is returning None.
I have tested the expression https://regex101.com/ and there it is returning the match. Haven't used regex much before and I might be doing it totally wrong. Could it be because of the newline at the start of the statement. If so, how can I handle that?