Skip to content
This repository has been archived by the owner on May 3, 2024. It is now read-only.

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

Open
jimallman opened this issue Aug 24, 2014 · 2 comments
Open

Comments

@jimallman
Copy link

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
Copy link

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
Copy link
Contributor

I just pushed a PR for this.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants