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

Please support RegExLib Sponsors

Sponsors

Expressions by User

   Displaying page 1 of 1 pages; Items 1 to 3
Title Test Details Split SQL UPDATE statement
Expression
(UPDATE\s+)(\w+)\s+(SET)\s+([\w+\s*=\s*\w+,?\s*]+)\s+(WHERE.+)
Description
Use with "/i" flag (case-insensitive) to match any valid SQL UPDATE statement, and to parse it into it's component parts. Most useful will be group $2, the table name, group $4, the field=value list, and group $5, the WHERE clause.
Matches
UPDATE table1 SET field1=value1,field2=value WHERE field4=value4
Non-Matches
UPDATE table1 SET field1=value1,field2=value
Author Rating: Not yet rated. Benjamin Nelson
Title Test Details Split SQL INSERT Statement
Expression
(INSERT INTO\s+)(\w+)(\s+\()([\w+,?\s*]+)(\)\s+VALUES\s+\()(['?\w+'?,?\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 value list.
Matches
INSERT INTO table (field1, field2) VALUES (value1, value2)
Non-Matches
INSERT INTO table VALUES (value1, value2)
Author Rating: Not yet rated. Benjamin Nelson
Title Test Details 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
   Displaying page 1 of 1 pages; Items 1 to 3

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