Hi -- On Thu, 4 Nov 2004, Paul Rubel wrote: > Hi, > > I'm trying to take a string and escape a single quote if it is not > already escaped. My first thought was to look at the string and if I > see a quote without a backslash before it put the backslash there. > > This has a problem when there is an escaped slash before the quote: > \\'. I believe the fix should be to look two characters back. If > anyone has a canned solution I'm all ears. Would look-behind be an > option here out of the box? I admit I get confused by escaping and stuff... but I can't quite picture the case you're describing. If a string contains a single quote: "abc'def" that's the same as: "abc\'def" So I don't think you'll actually see that backslash before the single quote when you scan the string. If you do see a slash -- i.e., if the string is: abc\'def then that would probably be generated with "abc\\'def", which would be equivalent to: "abc\\\'def" I'm afraid I didn't quite follow the Summer's Day example. Can you give another? David -- David A. Black dblack / wobblini.net