[thelist] Need a little Regex Help

david braun david.braun at centralnet.ch
Mon Sep 24 12:42:50 CDT 2001


[24.09.2001 - 9:08 Uhr]
Michael Buffington wrote:

> I'm having difficulty forming a regular expression in ColdFusion for finding
> strings that look like the following:
> 
> sql="SELECT col1, col2 FROM table WHERE col1 = 1;"
> sql="SELECT col1, col2 FROM table WHERE col2 LIKE 'cow';"
> sql="SELECT col1, col2 FROM table WHERE col2 IS NOT NULL" (notice lack of ;)
> 
> The string will always contain sql=" with a closing ". I've tried using
> sql="(.*);"  as my pattern to match, but that's producing some strange
> results (like finding everything from the start of the sql=" pattern to the
> end of the document (even though it seems to me it should stop at the first
> sign of the ; character.
> 

Michael

Though I use BBEdit, wich has some syntax of it's own, this should work:

sql="[^"]*"

wich means:

look for 
sql=" , followed by a string of any length and any character except " ,  then the closing "

" (<- what's this char called? I'd call it anführungszeichen : )

hth
david




More information about the thelist mailing list