Title |
Test
Find
MySQL Query File
|
Expression |
(?:
""(?:(?:(?:\\.)|[^""\\\r\n])*)""| #double-quoted strings
'(?:(?:(?:\\.)|[^'\\\r\n])*)'| #single-quoted strings
`(?:(?:(?:\\.)|[^`\\\r\n])*)`| #backticked names
(?:\s?(?:\#|--\ ).*(?=[\r\n]))| #hash comments or double-dash comments
(?:/\*(?:(?:[^*]|\*(?!/))*)\*/)| #multiline comments
(?:[^;`'""](?!(?:--\ |\#|/\*)))* #everything else not quote or followed by comment
(?:[^;`'""](?=(?:--\ |\#|/\*)))? #that last possible character before that comment
)* |
Description |
Splits a mysql query file by matching everything but the semicolon at the end. Handles all three comments ("-- ", "#", "/*...*/"), all three quotes (", ', `), and all three line break styles (\r, \n, \r\n).
Use with multiline and ignore whitespace/comments. |
Matches |
load mysql file "share\mysql_fix_privilege_tables.sql" for the full effect |
Non-Matches |
; |
Author |
Rating:
Patrick Zahra
|
Source |
|
Your Rating |
|
Title: WOW!
Name: taneth
Date: 10/17/2013 12:10:08 AM
Comment:
The library butchered the formatting, but once you get it lined up properly again it matches each query in sequence and then you just run them at your leisure.