Regular Expression question

W

William Morris

I'm trying to work out a reg.exp. that will pick out a sql statement against
a certain set of tables - in this case any table named "Survey~something~",
but I only want to pull back those statements where the CompanyID column
doesn't appear in the query. (The expression is being used in my editor so
it might appear a little strange, but by and large it works the same as
you'd expect.)

[^']select(.){0,100}from(.){0,100}Survey(.){0,25}where(.){0,200}

What do I need to add so that I get those without a companyid column?
Something like...

[^']select(.){0,100}from(.){0,100}Survey(.){0,25}where(.){0,200}(^companyid)

(tried this one, but it doesn't work)

Thanks!

- Wm
 
E

Evertjan.

William Morris wrote on 18 jun 2004 in
microsoft.public.inetserver.asp.general:
I'm trying to work out a reg.exp. that will pick out a sql statement
against a certain set of tables - in this case any table named
"Survey~something~", but I only want to pull back those statements
where the CompanyID column doesn't appear in the query. (The
expression is being used in my editor so it might appear a little
strange, but by and large it works the same as you'd expect.)

[^']select(.){0,100}from(.){0,100}Survey(.){0,25}where(.){0,200}

What do I need to add so that I get those without a companyid column?
Something like...

[^']select(.){0,100}from(.){0,100}Survey(.){0,25}where(.){0,200}(^compa
nyid)

(tried this one, but it doesn't work)

It should not. (^companyid) id not a correct negative lookahead
Should be (?!pattern) in jscript/vbscript.

However you are talking about an anonymous editor's regex (editpad?).

So what is the connection with ASP ???????????
 
W

William Morris

[^']select(.){0,100}from(.){0,100}Survey(.){0,25}where(.){0,200}(^compa
nyid)

(tried this one, but it doesn't work)

It should not. (^companyid) id not a correct negative lookahead
Should be (?!pattern) in jscript/vbscript.

However you are talking about an anonymous editor's regex (editpad?).

Homesite, actually.
So what is the connection with ASP ???????????

About three dozen queries in several ASP pages. Generally speaking, a
little off topic but I figured there would be a few people that might have
an answer.
 
E

Evertjan.

William Morris wrote on 18 jun 2004 in
microsoft.public.inetserver.asp.general:
[^']select(.){0,100}from(.){0,100}Survey(.){0,25}where(.){0,200}(^co
mpa nyid)

(tried this one, but it doesn't work)

It should not. (^companyid) id not a correct negative lookahead
Should be (?!pattern) in jscript/vbscript.

However you are talking about an anonymous editor's regex (editpad?).

Homesite, actually.
So what is the connection with ASP ???????????

About three dozen queries in several ASP pages. Generally speaking, a
little off topic but I figured there would be a few people that might
have an answer.

The problem is, that the regex specs are unknown.

In Jscript, I would first isolate the sql strings in an regex-match
collection and then regex-test those individually on the absence of the
word "companyid"
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,432
Messages
2,571,680
Members
48,796
Latest member
Greg L.

Latest Threads

Top