I need a regex that matches to both of these strings:
CREATE TEMPORARY TABLE db.table (cols)USING parquet PARTITIONED BY (DATA2, DATA3)
CREATE TABLE db.table (cols)USING parquet
The closest I've got is this:
CREATE +?(TEMPORARY +)?TABLE *(?P<db>.*?\.)?(?P<table>.*?)\((?P<col>.*?)\).*?USING.*?(PARTITIONED BY \((?P<pcol>.*?)\))
But that doesn't match to the second string. I've tried using a ?
on the end but that didn't help. basically I've been playing around with this for hours now and can't figure it out, so I'm resorting to SO.
I've set up a demo of this here: https://regex101.com/r/ffSVuD/1 If anyone feels game enough to try and solve it, be my guest!