Highlighting Common-sense url in Ruby
Consider a URL embedded in plain text, such as http://example.com/ . Stack overflow is smart enough to know that I didn't want to include the period at the end as part of the URL, even though it .
is an undeserved character according to RFC 3986 .
Likewise, if I find http://example.org/ , Stack Overflow is smart enough to know that I didn't want to include the comma, even though it is a member of the class sub-delims
, ,
is a valid path character.
Ruby URI.extract()
, as suggested in this and this highly accepted answer, not like stack overflow.
2.2.5 :002 > URI.extract('...such as http://example.com/.')
=> ["http://example.com/."]
2.2.5 :003 > URI.extract('Likewise, if I type http://example.org/, Stack Overflow...')
=> ["http://example.org/,"]
Is there a smarter alternative?
source to share
No one has answered this question yet
See similar questions:
or similar: