Displaying page
of
pages;
Items to
Title |
Test
Details
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
|
Title |
Test
Details
MySQL Query Comments and Strings
|
Expression |
("(?:(?:(?:\\.)|[^"\\\r\n])*)"|'(?:(?:(?:\\.)|[^'\\\r\n])*)'|`(?:(?:(?:\\.)|[^`\\\r\n])*)`)|((?:-- .*)|(?:#.*)|(?:/\*(?:(?:[^*]|\*(?!/))*)\*/))
|
Description |
Isolates MySQL Query strings and comments. Lines that look like comments inside strings are not falsely recognised as comments. To strip comments from a MySQL Query, simply replace all matches with group 1
|
Matches |
-- insurance, # renaming some primary keys, /**/, "hello -- this is not a comment"
|
Non-Matches |
ALTER TABLE table_insurance_covered
|
Author |
Rating:
Not yet rated.
Patrick Zahra
|
Displaying page
of
pages;
Items to