Link | LEAP_makeLink |
Author | Jonathan Guthrie |
Category | String |
Version | 9.x |
License | Public Domain |
Posted | 20 Dec 2010 |
Updated | 20 Dec 2010 |
More by this author... |
Parses a string for links to make clickable links.
Based on the RegExp published at http://daringfireball.net/2010/07/improved_regex_for_matching_urls
Accepts an optional keyword parameter "newWindow" that inserts _target="blank" if true. The default value is false.
LEAP_makeLink('Visit http://www.lassosoft.com/ every day!') LEAP_makeLink('Visit http://www.lassosoft.com/ every day!',-newWindow=true)
Click the "Download" button below to retrieve a copy of this tag, including the complete documentation and sample usage shown on this page. Place the downloaded ".inc" file in your LassoStartup folder, restart Lasso, and you can begin using this tag immediately.
define LEAP_makeLink(x::string,-newWindow::boolean=false) => { // ref http://daringfireball.net/2010/07/improved_regex_for_matching_urls #x = string(string_replaceregexp( #x, -find='(\\W|^)((?:https?://(?:[a-z0-9.\\-]+[.])+[a-z]{2,4}/)(?:[^\\s()<>]+|\\(([^\\s()<>]+|(\\([^\\s()<>]+\\)))*\\))*(?:\\(([^\\s()<>]+|(\\([^\\s()<>]+\\)))*\\)|[^\\s`!()\\]\\[{};:\'".,<>?«»])?)', -replace='\\1\\2' )) if(#newWindow) => { #x->replace('|XX|',' target="_blank"') else #x->replace('|XX|','') } return #x }
©LassoSoft Inc 2015 | Web Development by Treefrog Inc | Privacy | Legal terms and Shipping | Contact LassoSoft
Thank you