www.webdeveloper.com
Results 1 to 3 of 3

Thread: Multiple "Replace"

  1. #1
    Join Date
    Jan 2007
    Posts
    18

    Multiple "Replace"

    I have a page that displays news stories from a database using a simple databinding to a repeater control. The repeater control contains a Replace statement to format the line breaks properly:

    <%# Replace(DataBinder.Eval(Container.DataItem, "FullText" ), vbCrLf,"<br>") %>

    Now, I need to check the text for hyperlinks and convert plain-text url's into hyperlinks. I found the following function code for this:

    FUNCTION ConvertURL (ByVal strInputString As String) As String

    RETURN Regex.Replace(strInputString, "(\bhttp://[^ ]+\b)", "<a href=""$0"">$0</a>")

    END FUNCTION

    So how do I call this function and the previous Replace as well?

    Don

  2. #2
    Join Date
    Jun 2004
    Location
    Kansas City, MO
    Posts
    1,607
    Code:
    <%# ConvertURL(Replace(DataBinder.Eval(Container.DataItem, "FullText" ), vbCrLf,"<br>")) %>
    Or 
    <%# Replace(ConvertURL(DataBinder.Eval(Container.DataItem, "FullText" ), vbCrLf,"<br>")) %>

  3. #3
    Join Date
    Jan 2007
    Posts
    18
    Thank you!

    Don

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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



Recent Articles