PDA

View Full Version : Tcl Regexp problem



oaul
March 17th, 2009, 04:27 PM
lets say I have a variable foo set as paul

% set foo paul

I want to see if the string "$paul" is in the line "$paul is smelly"

% set line {$paul is smelly}

% puts "\$$foo"
$paul

Here is where I am messing up:
regexp "\$$foo" $line
0

Any suggestions?

oaul
March 17th, 2009, 04:29 PM
Nevermind. I am stupid.

SHOULD be:
regexp "\\$$foo" $line

which works just fine. My bad