On Wednesday, March 3, 2004, at 10:21 AM, Trevor DeVore wrote:


Has anyone written a function that will find all instances of a string in the htmlText of a field EXCEPT if it appears in a tag such as <a></a>? I need to hilite all instances of the string in the field. I figure I'm either missing a really obvious function already in Rev that will do it or I need a fancy regular expression.

I assume you want the character offset.


One approach would be to use a loop and a matchChunk. The match chunk would find the start of the match and the start of the rest. This is applied to rest until there is no rest (so to speak). Collect the offsets or process them as you find them. One problem is that this might run afoul of bug 16. In that case, limit yourself to a maximum number of elements to be ignored between each instance.

If you just want to count them or something, then use replaceText() to remove the <a></a> and then count the string instances.

Dar Scott

_______________________________________________
use-revolution mailing list
[EMAIL PROTECTED]
http://lists.runrev.com/mailman/listinfo/use-revolution

Reply via email to