English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

For example, on my website, if someone is writing an email address or a website address, i want to convert them into a link.
For example if someone writes http://www.website.com, when viewing i should be able to click on this link so basically it should be convert to http://www.website.com

Thankyou.

2006-07-04 09:18:21 · 3 answers · asked by Manish 5 in Computers & Internet Programming & Design

3 answers

Ignore the prior question, it's absolutely incorrect. You would need to use a search and replace function on the input, looking for things that look like links and adding the anchor tag around them.

Preg replace (linked below) is the typical way of doing this. What you will need is one or more regexes. Explaining regex is beyond the scope of what I can provide in Yahoo answers. I did link a great site that will help introduce and teach regex's to you. They are essential to understand for any pro web developer.

The basic idea would be to look for the pattern: 'http://..' You'd then replace this with the matched pattern, only adding the anchor tag around it.

2006-07-04 11:00:20 · answer #1 · answered by Gizmo L 4 · 3 1

See the links. Testing's up to you -- depends on how fancy your page is whether this would work or not.

2016-03-27 03:51:20 · answer #2 · answered by ? 4 · 0 0

bool link ( string target, string link )

2006-07-04 09:30:48 · answer #3 · answered by rohitsharmas_22 2 · 0 0

fedest.com, questions and answers