Thursday, March 31, 2011

Re: Regular Expression Help

Alessandro,

On Fri, Apr 1, 2011 at 11:05 AM, Alessandro Antonello <antonello.ale@gmail.com> wrote:
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...

This should work:

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

1. You need to escape the +, (, ), | metacharacters
2. The value part is 0 or more \' or [^'] sequences
 
Regards, Terence.

--
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: