regex variable pattern

Q&A's, tips, howto's
Locked
Grundle
Posts: 15
Joined: Mon Mar 28, 2005 9:26 pm

regex variable pattern

Post 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.

Lutz
Posts: 5289
Joined: Thu Sep 26, 2002 4:45 pm
Location: Pasadena, California
Contact:

Post by Lutz »

Yes, of course this would work, just like you wrote it!

You can use variables anywhere in newLISP.

Lutz

Grundle
Posts: 15
Joined: Mon Mar 28, 2005 9:26 pm

Post 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

Locked