I'm witing a script (using VBScript), which will colour code SQL statements. I'm using regular expressions to find matches. When a keyword is found I set the font to blue etc., which I've done, but...

I'm having difficulty telling it not to find matches within single quotes!

for example -

I want it to find -
select t.Start_Dat 
from Tariff5 t 
where t.Ref= ...

but not -
... t.Ref = 'Hello World  <>  of where blah, blah'
Here is my pattern so far -

"(^\s+|[\s(,])(" & key(i) & ")(\s|\)|\,|$)"
any help or ideas will be gratefully received

Cheers Al