Guest User

Untitled

a guest
Jun 20th, 2018
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.70 KB | None | 0 0
  1. INSERT INTO table_name (c1,c2,c3) VALUES ('',N'user','','1970-01-01 00:00:00.0')
  2.  
  3. table_name
  4. c1,c2,c3
  5. '',N'user','','1970-01-01 00:00:00.0'
  6.  
  7. final String regex = "((?<=(INSERT\sINTO\s))[\w\d_]+(?=\s+))|((?<=\()([\w\d_,]*|[N?'?.*\s?.*'?,]*)+(?=\)))";
  8.  
  9. table_name
  10. c1,c2,c3
  11. '',N'user',''
  12.  
  13. final String regex = "((?<=(INSERT\sINTO\s))[\w\d_]+(?=\s+))|((?<=\()([\w\d_,]*|[N?'?.*\s?.*'?,]*)+(?=\)))";
  14.  
  15. String test = "INSERT INTO table_name (c1,c2,c3) VALUES ('',N'user','','1970-01-01 00:00:00.0')";
  16.  
  17. Pattern re = Pattern.compile(regex, Pattern.CASE_INSENSITIVE);
  18.  
  19. Matcher m = re.matcher(test);
  20. while (m.find())
  21. {
  22. System.out.println(m.group(0));
  23. }
Add Comment
Please, Sign In to add comment