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

Please support RegExLib Sponsors

Sponsors

Regular Expression Details

Title Test Find Split SQL INSERT Statement 2
Expression
(INSERT INTO\s+)(\w+)(\s+\()([\w+,?\s*]+)(\)\s+VALUES\s+)((\(['?\w+'?,?\s*]+\)\,?;?\s*)+)
Description
Use with "/i" flag (case-insensitive) to match a fully qualified SQL INSERT statement, and to parse it into it's component parts. Group $2 will contain the table name, $4 the field list, and $6 the all of the value lists.
Matches
INSERT INTO table (field1, field2) VALUES (value1, value2); (value3, value4) or INSERT INTO table (field1, field2) VALUES (value1, value2), (value3, value4)
Non-Matches
INSERT INTO table VALUES (value1, value2)
Author Rating: Not yet rated. Benjamin Nelson
Source TxITGuy
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

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