At 1:57 PM +0900 13/2/2000, Nicolas R Cueto wrote:
>Anyway, when using matchText(tSource, tRegex) if in tRegex there happens
>to be one of the special characters, this execution error results:
>
>matchChunk: error in pattern expression
>bad token: nested *?+
>
>FYI, I'm using matchText to compare two word-lists and find the words
>unique to one. With some word-lists, matchText works swell; with others,
>matchText (or my scripting of it) seems to choke when things like "*.au"
>and "C++" get stored in tRegex. I'm aware that special characters can be
>escaped but how can I do this if tRegex is a container and not a
>literal? (Hope I'm making more sense to someone about my
>containers/literals distinction than I am to myself.)
Hi Nicolas
This suggestion is untried:
Before calling matchText, prepare the tRegex expression with a
function like this:
function escapeSpecialChars pString
replace "\" with "\\" in pString --escape "\" first
repeat for each char tChar in "*[]+.$^" -- special characters
replace tChar with "\" & tChar in pString
end repeat
return pString
end escapeSpecialChars
But I'm wondering if this is the easiest way to do what you want. For
example, if the two word lists are both return delimited lists, would
this do what you need?
repeat for each line tWord in tList1
if tWord is not among the lines of tList2 then
-- store tWord somewhere
end if
end repeat
Cheers
Dave Cragg
This is the MetaCard mailing list.
Archives: http://www.mail-archive.com/metacard%40lists.best.com/
Info: http://www.xworlds.com/metacard/mailinglist.htm