Find URI in text: Difference between revisions
Content added Content deleted
(→Tcl: Added implementation) |
m (→{{header|Tcl}}: add comment) |
||
Line 245: | Line 245: | ||
This uses regular expressions to do the matching. It doesn't match a URL without a scheme (too problematic in general text) and it requires more than ''just'' the scheme too, but apart from that it matches slightly too broad a range of strings (though not usually problematically much). Matches some IRIs correctly too, but does not tackle the <tt><bracketed></tt> form (especially not if it includes extra spaces). |
This uses regular expressions to do the matching. It doesn't match a URL without a scheme (too problematic in general text) and it requires more than ''just'' the scheme too, but apart from that it matches slightly too broad a range of strings (though not usually problematically much). Matches some IRIs correctly too, but does not tackle the <tt><bracketed></tt> form (especially not if it includes extra spaces). |
||
<lang tcl>proc findURIs {text args} { |
<lang tcl>proc findURIs {text args} { |
||
# This is an ERE with embedded comments. Rare, but useful with something |
|||
# this complex. |
|||
set URI {(?x) |
set URI {(?x) |
||
[a-z][-a-z0-9+.]*: # Scheme... |
[a-z][-a-z0-9+.]*: # Scheme... |