ruby - How can I match a URL but exclude terminators from the match? -
I want to match the URL in the text and want to replace it with the anchor tag, but I want to exclude some terminator Want to tweet the url in tweets like url
So far I have found this, but it is clearly not working very well.
(http [s]? \: \ / \ / [A-zA-Z0-9 \ - \. +. [A-zA-Z] {2,3} ( \ / \ * S *)?) Edit: Some example URLs In all cases given below, / P> .
:
"http: // www example.com"
;
!
[http://www.example.com]
{http: //www.example.com}
*
I saw the last issue on this issue and developed the solution that you might want to see - see: this link is difficult There is a test page for JavaScript solutions with many examples of URLs linking to.
The Rejx solution written for both of my PHP and Javascript - (but can be easily translated into Ruby) is not easy (but this is also the problem as it turns out.) For more information I also recommend reading:
Jeff Atwood, and After reading Jeff's blog post, it is necessary to read the comments if you want to correct it. ..
Comments
Post a Comment