re = /(?<=from|join|table|into|exists|update) (?!IF)(\w+\.*)+/im
str = 'SELECT * FROM COLLECTIONNAME.SCHEMANAME.TABLENAME LEFT JOIN SCHEMANAME.TABLENAME ON A.D = B.D
CREATE TABLE IF NOT EXISTS SCHEMANAME.NEWTABLENAME, SCHEMANAME.NEWTABLENAME
ALTER TABLE SCHEMANAME.EXISTINGTABLENAME
CREATE TABLE table_name (column_1 datatype, column_2 datatype, column_3 datatype);
DELETE FROM table_name WHERE some_column = some_value;
INSERT INTO table_name (column_1, column_2, column_3) VALUES (value_1, \'value_2\', value_3);
select * from A join (select top 5 * from B) on B.ID = A.ID where A.ID in (select ID from C where C.DOB = A.DOB)
Select distinct W.WORKER_ID, W.FIRST_NAME, W.Salary
from Table1 W, Table2 W1
where W.Salary = W1.Salary
and W.WORKER_ID != W1.WORKER_ID;
left '
# Print the match result
str.scan(re) do |match|
puts match.to_s
end
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 Ruby, please visit: http://ruby-doc.org/core-2.2.0/Regexp.html