Regular Expression

I have a dynamic url string which I am trying to convert the string to html bold string character.

For example

Therefore $url='<b>http:</b>

This is not the output that I want. How do you change the regular expression to get my desired out that is

Pls bare in mind that the url is dynamic.
Who is Participating?
andreifConnect With a Mentor Commented:
If there is only URL in the string, use


If there is another text, you should define the end of url:

$url=' something else'

or limit characters that can be included into the url (not sure that I remember all chars, check this :)

$url = "<b>$url</b>";

Is that what you meant?
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.