gamename
2005-08-14 04:49:42 UTC
Hi,
I'm using a regex to detect errors. Since there are numerous possible
errors, I'm trying to store them in a var. For some reason, the regex
stops working when the var has a continuation. Example:
expect1.99> set line "% Invalid input detected at '^' marker."
% Invalid input detected at '^' marker.
expect1.100> set ERROR {\
^%|\
}
expect1.101> regexp $ERROR $line
1 <--- worked
expect1.102> set ERROR {\
^%|\
^% Invalid input detected\
}
expect1.103> regexp $ERROR $line
0 <--- Failed
Why would it work in the first instance and fail in the second?
TIA,
-Tennis
I'm using a regex to detect errors. Since there are numerous possible
errors, I'm trying to store them in a var. For some reason, the regex
stops working when the var has a continuation. Example:
expect1.99> set line "% Invalid input detected at '^' marker."
% Invalid input detected at '^' marker.
expect1.100> set ERROR {\
^%|\
}
expect1.101> regexp $ERROR $line
1 <--- worked
expect1.102> set ERROR {\
^%|\
^% Invalid input detected\
}
expect1.103> regexp $ERROR $line
0 <--- Failed
Why would it work in the first instance and fail in the second?
TIA,
-Tennis