Is there a regexp feature that lets me require something to be present in the input string for the regexp to match, but for that to not become captured as part of the match? I want this so that I can scan and gsub on a string of code and replace variables. Matching just variables requires looking at the context arround them, but if I capture this, I replace the context too. Eg, to scan for variables called x or y, I might use: /(^|[^a-zA-Z])[xy]([^a-zA-Z]|$)/ but using that on "exp(x)" will match (and replace) "(x)", which I don't want at all. Cheers, Benjohn