This is the new home of the egghelp.org community forum.
All data has been migrated (including user logins/passwords) to a new phpBB version.


For more information, see this announcement post. Click the X in the top right-corner of this box to dismiss this message.

regexp and its *maddening* ways of handling vars

Help for those learning Tcl or writing their own scripts.
Post Reply
User avatar
rosc2112
Revered One
Posts: 1454
Joined: Sun Feb 19, 2006 8:36 pm
Location: Northeast Pennsylvania

regexp and its *maddening* ways of handling vars

Post by rosc2112 »

::rant::
Can someone explain why regexp will work with something like:

Code: Select all

set mylameregexp "blah blah($somevarIwanttoGrep) blah"
regexp $mylameregexp $varIamGrepping match myvar
But WON'T work with:

Code: Select all

regexp {blah blah ($somevarIwanttoGrep) blah} $varIamGrepping match myvar
yes I realize that the $ is supposed to indicate an end of line, but then, why does $mylameregexp work? Nevermind, I think I know the answer :P


Trying to set certain patterns in vars is itself an exercise in creative kludging...

::end rant::
User avatar
Sir_Fz
Revered One
Posts: 3794
Joined: Sun Apr 27, 2003 3:10 pm
Location: Lebanon
Contact:

Post by Sir_Fz »

If you replace the braces ({}) with quotes ("") it will be the same.
User avatar
rosc2112
Revered One
Posts: 1454
Joined: Sun Feb 19, 2006 8:36 pm
Location: Northeast Pennsylvania

Post by rosc2112 »

Good to know, thanks :)
Post Reply