Text Replace function

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Mark Tait

    Text Replace function

    Hi - I'm using the replace function to hilite search words in text which
    is returned. However, as the text which is being searched also includes
    HTML, I find sometimes that the HTML tags can be replaced, which in turn
    messes up the text which is dieplayed.

    Is there any way of checking only text which does not appear between <>
    tags?

    eg.

    myText="<img src='bob.gif'>b ob"
    mySearch="bob"

    replace(myText, mySearch,"<b>" & mySearch & "</b>")

    ...this will end up:

    myText="<img src='<b>bob</b>.gif'><b>bob </b>"

    Has anyone any ideas?

    Many thanks,


    Mark Tait
    mark@fixitks.co .uk

    Knowledge Management Solutions

    *** Sent via Developersdex http://www.developersdex.com ***
    Don't just participate in USENET...get rewarded for it!
  • Evertjan.

    #2
    Re: Text Replace function

    Mark Tait wrote on 03 jul 2003 in
    microsoft.publi c.inetserver.as p.general:
    [color=blue]
    > Hi - I'm using the replace function to hilite search words in text
    > which is returned. However, as the text which is being searched also
    > includes HTML, I find sometimes that the HTML tags can be replaced,
    > which in turn messes up the text which is dieplayed.
    >
    > Is there any way of checking only text which does not appear between
    > <> tags?
    >
    > eg.
    >
    > myText="<img src='bob.gif'>b ob"
    > mySearch="bob"
    >
    > replace(myText, mySearch,"<b>" & mySearch & "</b>")
    >
    > ..this will end up:
    >
    > myText="<img src='<b>bob</b>.gif'><b>bob </b>"
    >
    > Has anyone any ideas?
    >[/color]

    This replace is not a good idea.

    do something with:

    txt.select();

    like in:

    <http://www.javascripte r.net/faq/searchin.htm>

    --
    Evertjan.
    The Netherlands.
    (Please change the x'es to dots in my emailaddress)

    Comment

    Working...