Thursday, March 31, 2011

Regular Expression Help

Hi, all.

I have a problem building a regular expression for fields in a SQL UPDATE
statement. The SET clause has the format as follows:

field1 = 'value of field1', field2 = 'field\' 2 value'

I have built a regular expression that can split the name of fields from its
values. But when a value has an escaped single-quote the regular expression
fails. I know that it fails because I am using the expression [^'] in between
the parenthesis. But how to fix this?

This is the regular expression I am using:

/(\w+)\s*=\s*(('[^']*'\s*,)|(\d+\s*,))\s*/i

Could someone help me with that?

Alessandro Antonello

--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

No comments:

Post a Comment