regex question in matchChunk function
zryip.theslug at gmail.com
Thu Dec 17 15:58:09 EST 2009
It seems that I have missed the good tread. Apologizes if it's a double
To enclose a word without its punctuation you have to define a list of
substitute strings like this :
-> the list of possible form
" <w> ","<w>,","<w>.",".<w>",".<w>."
-> the substitute list
With this approach you'll be able to keep your punctuation alive. I'm sure
it'll thank us 8)
To create a list of possible form of whole word, you could:
1) Define the list of punctuation which could starts a word
i.e. : colon,space,nothing,comma ....
2) Define the list of punctuation which could ends a word
i.e. : -,colon,dot,comma ...
3) Then mix all possibilities by two imbricated loops (okay it's like
cooking i'm presume 8))
So you'll obtain something like that :
put "colon,space,comma,nothing,quote" into startCharsList
put "colon,dot,comma,-" into endCharsList
put "<w>" into keyWord
put "<box>" into htmlTag
put "" into wholeWordList
put "" into substituteList
-- Create the list of whole words and its substitute list
repeat with startCharNum = 1 to number of items of startCharsList
repeat with endCharNum = 1 to number of items of endCharsList
put item startCharNum of startCharsList & keyWord & item endCharNum of
endCharsList&"," after wholeWordList
put item startCharNum of startCharsList & htmlTag & keyWord & htmlTag & item
endCharNum of endCharsList&"," after substituteList
-- Search and boxed one or a list of words
repeat with aWord in wordList
repeat with wholeWordForm in wholeWordList
put replaceText(wholeWordForm,"<w>",aWord) into wholeWordForm --
replace the "<w>" key in your pattern by the word that you need
get fld "yourField"
replace wholeWordForm with itSubstituteForm in it
See how it could work ?
However not sure of the time of processing...
Not tested but it's a possibility.
Anyway you've already found your way and that is the main, so try this if
you would ;)
-Zryip TheSlug- wish you the best ! 8)
2009/12/17 Chris Sheffield <cmsheffield at gmail.com>
> Thanks to all who replied and offered suggestions. I ended up using the
> "find" command on my field in order to accomplish what I need. While
> probably not super speedy, it seems to be working well. Fortunately the
> story passages are not too long, so the decreased speed is really not that
> Thanks again,
> Chris Sheffield
> Read Naturally, Inc.
> use-revolution mailing list
> use-revolution at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
More information about the Use-livecode