3 ms·
You're right. Looking closer, it also ignores URLs with a fragment after a #. Looking closer still, adding these (@ and #) to the regex would open a whole new
by jsdalton 18y ago
You're right.
Looking closer, it also ignores URLs with a fragment after a #. Looking closer still, adding these (@ and #) to the regex would open a whole new can of worms, since the parsing statements below would attempt to convert these to URLs as well. As it stand now, it would probably mess up URLs with those characters in them, since they would be parsed as usernames or hashtags.
Hence the dangers of grabbing stuff off the Internet, as I did! If I have time to fix this later I'll post an update.
- Tichy 18y agoI thought it might not be perfect, but making it perfect is probably next to impossible. Here is a link with some monstrous URL matching Regexps: http://www.regexguru.com/2008/11/detecting-urls-in-a-block-of-text/ http://www.regexguru.com/2008/11/detecting-urls-in-a-block-o...
- deleted 18y ago[deleted]
- gord 18y agooh yeah... regex to match all urls == ugly hack. Why didnt they just define urls by a simple FSM / regex in an RFP ? Hey, I complain about the internet..but I do appreciate RFCs... Sweet lord, have a look at the UML / MOF spec - its hilariously vague and amorphic.