Page 1 of 1

regex variable pattern

Posted: Thu Jun 09, 2005 4:46 pm
by Grundle
I was wondering if it is possible to use a variable for a pattern in a regex. My code looks something like the following.

Code: Select all

(set 'var1 (pop some-stack))

(if (find var1 var2 0)
     ;continue execution here
)
Obviously this doesn't work, but hopeful explains what I am trying to do.

Posted: Thu Jun 09, 2005 5:50 pm
by Lutz
Yes, of course this would work, just like you wrote it!

You can use variables anywhere in newLISP.

Lutz

Posted: Thu Jun 09, 2005 6:42 pm
by Grundle
Yes you are right, and in fact I was doing the following.

Code: Select all

(if (not (find (rest tag) s-tag 0))
The problem of course is that I put a quote before s-tag

Code: Select all

's-tag
which of course will ruin everything. It turns out to be something of an embarrassing oversite

:D