In addition: http://www.bennadel.com/bl
Main Topics
Browse All TopicsI have a CF function - gleaned, I think, from a previous ExEx response - which takes a large amount of plain text or html, and finds all of the url strings that are not already linked, beginning with "www" or "http", and creates actual hyperlinks when output to the page.
It works pretty well, but there are a few issues I am hoping to fine-tune.
1) Most important - if there is not a space after the last character of the url (i.e. ".com" is followed by a period, or, if html, by a closing </p> tag with no space), those characters get included in the match and I end up with a bad link.
2) I need this to also match "https://" links, which means altering the way it does the 'replace ' part of the function, since the http:// is currently hard coded.
Note - the 'request.smartlinknew' is my own code, using David Powers' SmartLink JS to open these links in a new window.
Thanks in advance for your help!
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
In addition: http://www.bennadel.com/bl
@steeza
>> 1: Try (http://|https://|www)(.*?
This is slightly better, a period following the link is now excluded. But if the link is immediately followed by an html tag, i.e.
www.something.com<br />
The link looks like this
href="http://www.something
with the first part of the html tag " <br " included inside the href attribute, and the rest, " /> " , visible on the page.
aha!
This
>> http://www.bennadel.com/bl
was actually very helpful! Ben to the rescue again!
I gleaned the proper regex from his code, and added my own option to check for https as the first 5 chars, otherwise assume http
My completed link matching function is below, hopefully others can use it as well.
Full points, thanks again!
Business Accounts
Answer for Membership
by: steezaPosted on 2009-03-04 at 05:32:13ID: 23794510
1: Try (http://|https://|www)(.*? )(?=[^a-zA -z0-9]*([[ :space:]]| ($))) for your reFind expression.
2: As for your URL rendering bit, I would go for something like:
If the link starts with https or http then put it in as is, otherwise append the http://