LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 07-30-2014, 12:24 AM   #1
Lucien Lachance
Member
 
Registered: May 2013
Posts: 82

Rep: Reputation: Disabled
Matching Image URIs


How can I properly match for both of these image links using regex? I've been able to get away with /^http:\/\/\d+/ for awhile, but I've noticed lately some blogs contain image links without digits. I've come up with this, but I would like to know if I can do this better.

Standard:
/^http:\/\/(\d+|media)/

Alternate:
%r{^http://(\d+|media)}

Here are the blog images formats:
Code:
http://37.media.tumblr.com/avatar_c36b653e187f_30.png
http://media.tumblr.com/c106781145cf6c3b1f3cb993cd783cf2/tumblr_inline_mqcvcuoNlE1qz4rgp.jpg

Last edited by Lucien Lachance; 07-30-2014 at 12:54 AM.
 
Old 08-06-2014, 12:05 PM   #2
eSelix
Senior Member
 
Registered: Oct 2009
Location: Wroclaw, Poland
Distribution: Arch, Kubuntu
Posts: 1,281

Rep: Reputation: 320Reputation: 320Reputation: 320Reputation: 320
Maybe I not entirely understand, but why not all links with images extensions:
Code:
^http://.+\.(?:jpg|jpeg|png)$
 
  


Reply

Tags
regex, regexp, ruby



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] problem with apt-get, print uris qrange Debian 2 10-14-2013 01:10 AM
Removal of highlight URIs -- is this automated? I think it should stop gnuweenie LQ Suggestions & Feedback 0 06-13-2011 03:51 AM
Ubuntu: How to remove/edit printer URIs? fopetesl Linux - Software 3 07-05-2010 07:51 AM
I want to know as to which tool/software is the best for Image Matching(.tiff format) deepumnit Linux - Software 1 01-10-2007 03:54 AM
firefox, Skype and callto:// URIs Artanicus Linux - Software 1 09-03-2005 04:57 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 08:11 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration