RegExLib.com - The first Regular Expression Library on the Web!

Please support RegExLib Sponsors

Sponsors

Regular Expression Details

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: The rating for this expression. Patrick Zahra
Source
Your Rating
Bad Good

Enter New Comment

Title

Name

Comment

Spammers suck - we apologize. Please enter the text shown below to enable your comment (not case sensitive - try as many times as you need to if the first ones are too hard):

Existing User Comments

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.


Copyright © 2001-2025, RegexAdvice.com | ASP.NET Tutorials