djcas9 / komanda

The IRC Client For Developers
http://komanda.io
MIT License
1.78k stars 75 forks source link

Regexp for images (and others?) are confused by nearby punctuation #202

Open jimallman opened 10 years ago

jimallman commented 10 years ago

These chat messages will embed the specified image:

http://i.imgur.com/aNRAMkp.gif

test test http://i.imgur.com/aNRAMkp.gif

test http://i.imgur.com/aNRAMkp.gif test

... but this one fails (presumably because of the trailing parenthesis):

(i usually add text around them, like this: http://i.imgur.com/aNRAMkp.gif) 
tbpalsulich commented 10 years ago

See the last regex entry in this discussion: http://www.regexguru.com/2008/11/detecting-urls-in-a-block-of-text/

This works by only allowing matching parenthesis in a URL. So, you don't have to worry about the above case.

I'll look at this more in the next few days, unless someone beats me to it. :)

h0lyalg0rithm commented 10 years ago

I just pushed a PR for this.