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

Please support RegExLib Sponsors

Sponsors

Regular Expression Details

Title Test Find 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
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

Title: RE: Test Find Split SQL UPDATE statement
Name: Awateru
Date: 9/30/2009 6:52:44 PM
Comment:
This doesn't match any valid SQL update statement as WHERE is optional, such as updating all binary fields for all lines to true, etc..


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