Friday, 6 September 2013

Regex has unexpected results. I am new to this, fair warning

Regex has unexpected results. I am new to this, fair warning

The following regex does match what I am looking for, but it will also
match all file extensions (just the file extensions) of anything ending
with gif|jpg|png
webcomic"\ssrc="http://www\.explosm\.net/[a-zA-Z/]+\.gif|png|jpg"\s
I am using it on the source of the following page, which is a webcomic
that is updated daily:
http://www.explosm.net/comics/
Today, the end goal would be the following, and only the following:
webcomic" src="http://www.explosm.net/db/files/Comics/Kris/lawyer.gif"
I'm just getting my feet wet with regex, have browsed a few websites but
can't figure this one out. I don't get why just the file extensions are
getting matched, when their file paths/urls do not match the rest of my
pattern.
Any help appreciated

No comments:

Post a Comment