Passing contents of a variable to a regular expression
Sannyasin Sivakatirswami
katir at hindu.org
Tue Sep 17 16:35:00 EDT 2002
I have a stack where editors are to use a single character to tag a
word to be deleted... But I want them to be able to custom select the
character to serve as this delimiter, store that as a preference and
then later pull it into a regular expression... but I don't see how to
do that:
(Thanks to Ken Ray for getting me this far!)
on cleanUpEditedOriginal
put fld "deleteDel" of stack "prefs" into lDeleteDel
## assume its an "*" asterisk for this test
put fld "original" into jai
repeat until tToggle = 1
if matchtext (jai,"(\(.*?\))",tDeletion) then
## in this case "()" are wrapping text to be deleted.
## but we want to use the contents of lDeleteDel in this
expression
## as in something like: "(\[lDeleteDel].*?\[lDeleteDel])"
## which would resolve to "(\*.*?\*)" in this case
## where lDeleteDel is an * (asterisk--but it could be any
single char)
replace tDeletion with "" in jai
else
put 1 into tToggle
end if
end repeat
replace " " with " " in jai
put jai into fld "clean"
end cleanUpEditedOriginal
Any clues?
Thanks!
Himalayan Academy Publications
Sannyasin Sivakatirswami
Editor's Assistant/Production Manager
katir at hindu.org
www.HinduismToday.com, www.HimalayanAcademy.com,
www.Gurudeva.org, www.hindu.org
More information about the use-livecode
mailing list