|
-
Jun 18th, 2003, 10:44 AM
#1
Thread Starter
Fanatic Member
Regular Expression Question
I want to match insert statements that have a select clause instead of a values clause. (i.e. "insert into... select * from ..." but not "insert into ... values(...)"
I use the following regular expression:
\binsert\b(?:.|\n)+?(?!values)\bselect\b
I thought that the (?!values) would tell the parser to stop if it hit the string "values", but perhaps I do not fully understand negative lookaheads...
Is there any way I can accomplish my goal?
BTW, disable smilies unless you want some weird looking regular expressions ;)
-
Jun 19th, 2003, 07:39 PM
#2
Lively Member
-
Jun 20th, 2003, 02:54 PM
#3
Thread Starter
Fanatic Member
Transact SQL (and perhaps ANSI SQL) allows for at least two versions of the INSERT statement.
Insert [into] table1 (column1, column2, ...) values (value1, value2, ...)
and
Insert [into] table1 (column1, column2, ...) select columnA, columnB, ... from tableA
I was trying to build a regular expression that would match the second type of INSERT statement, but not the first.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|