# String replace (recognize an url and make a link)

**URL:** <https://forum.kirupa.com/t/string-replace-recognize-an-url-and-make-a-link/308237>\
**Category:** Uncategorized\
**Created:** [April 19, 2010, 11:08pm UTC](https://forum.kirupa.com/t/string-replace-recognize-an-url-and-make-a-link/308237 "2010-04-19T23:08:01Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![chespy](https://avatars.discourse-cdn.com/v4/letter/c/f08c70/32.png) [@chespy](https://forum.kirupa.com/u/chespy)\
**Post date:** [April 19, 2010, 11:08pm UTC](https://forum.kirupa.com/t/string-replace-recognize-an-url-and-make-a-link/308237/1 "2010-04-19T23:08:01Z")

</div>

Hi! I’m looking for some help with it…

Trying to recognize urls from an xml text (as1)  
I have not access to edit the xml.  
The url is loaded as string, ex: “lorem ipsum dolor sit [http://kirupa.com/bla](http://kirupa.com/bla)”  
The url is not always at the end of the string

I’m loading it and showing as htmlText, but the url is not likeable (coz have no tags T.T )

using split and join i got:

```auto
function sar(holder, searchfor, replacement) {
    tarray = holder.split(searchfor);
    holder = tarray.join(replacement);
    return (holder);
}
myConvertedText = sar("lorem ipsum dolor sit http://kirupa.com/bla", "http://", "<a href='http://");
//result: lorem ipsum dolor sit <a href='http://kirupa.com/bla

```

As the ur is not ever the last word in the string I can not add the tags at the end…

How can I get, count or recognize the end of url to add the html tags?

any help is very welcome…  
Thanks…
