java - Text Mining sql schema files -


i have collection of big sql files. files want keep "create table" , "alter table add constraint foreign key" statements. there toll can use mine 2 regular expressions? know use grep don't have linux

you can build small java program obtain such sentences. e.g.:

string input = new string(files.readallbytes(paths.get("file.sql")), "utf-8"); string regex = "(?i)((create table|alter table add constraint foreign key)[^;]+;)"         .replace(" ", "\\s+"); pattern pattern = pattern.compile(regex); matcher matcher = pattern.matcher(input); while (matcher.find()) {     system.out.println(matcher.group()); } 

Comments

Popular posts from this blog

javascript - Using jquery append to add option values into a select element not working -

Android soft keyboard reverts to default keyboard on orientation change -

jquery - javascript onscroll fade same class but with different div -