Jump to content
UBot Underground

Recommended Posts

I've been searching for something like that but couldn't find it.

I have a text like:

"Go to http://mydomain.com/blabla and see what I'm talking about"

or

"Go to http://www.mydomain.com.br/ and see what I'm talking about"

I want to be able to replace the domain name with something.  For instance, an <a> element:

"<a href="http://mydomain.com/blabla?someParam=someValue">Some text</a>"

I tried using reg exp replace, but it's not working for me.

Any idea how to make this work?

 

Link to post
Share on other sites

Hello.

 

It depends a little bit on the type of URLs you have to support. If they also contain stuff like ?id=xa77t then my example will not work.

But for a regular ULR wil text and numbers, it works.

 

So hopefully it helps a little bit to get you started.

 

set(#test"Go to http://mydomain.com/blabla and see what I'm talking about""Global")
set(#test1"Go to http://www.mydomain.com.br/ and see what I'm talking about""Global")
set(#test2$replace regular expression(#test"\"<a href=\"http://mydomain.com/...Param=someValue\">Some text</a>\""), "Global")
set(#test3$replace regular expression(#test1"\"<a href=\"http://mydomain.com/...Param=someValue\">New text</a>\""), "Global")

 

If you need support for other stuff, just add that into the [a-zA-Z0-9./]

The important thing is to have a space after the URL. Because that's the separator. 

 

Cheers

Dan

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...