// include the latest version of the regex crate in your Cargo.toml
extern crate regex;
use regex::Regex;
fn main() {
let regex = Regex::new(r"(?im)(?<=from|join|table|into|exists|update) (?!IF)(\w+\.*)+").unwrap();
let string = "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 ";
// result will be an iterator over tuples containing the start and end indices for each match in the string
let result = regex.captures_iter(string);
for mat in result {
println!("{:?}", mat);
}
}
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 Rust, please visit: https://docs.rs/regex/latest/regex/