Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2

Thread: Reg Exp

  1. #1
    Regular Coder
    Join Date
    Apr 2005
    Location
    Ireland
    Posts
    122
    Thanks
    4
    Thanked 0 Times in 0 Posts

    Reg Exp

    Hi

    I have a string which may contain multiple occuernces of a search term in it.
    I need to highlight each occurence of the search term by spacing a <span> around it.
    I currently have:

    Code:
    <cfset formatedEventName   = REReplaceNoCase(qSearchDetailsSorted.EventName,(ls_txtString),"<span class=searchHighlight></span>","ALL") />
    Where qSearchDetailsSorted.EventName is the string and ls_txtString is the search term.
    I dont know what to put inside the opening & closing span to output the actual search term in the string?

    Thanks in advance

  • #2
    Regular Coder
    Join Date
    Apr 2005
    Location
    Ireland
    Posts
    122
    Thanks
    4
    Thanked 0 Times in 0 Posts
    Firured it out eventually for any1 interested.

    Code:
    <cfset formatedEventName   = REReplaceNoCase(qSearchDetailsSorted.EventName,"(#ls_txtString#)","<span class=searchHighlight>\1</span>","ALL") />


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •