3

I tried this expression

 SELECT * FROM `table` WHERE COL REGEXP "^([%\w-]+\.(?:jpe?g¦JPE?G¦gif¦GIF¦png¦PNG))$"

Please help me

2
  • how are these image links stored in the table Commented Apr 23, 2012 at 3:10
  • image links is http://(.*?)\.(jpg|png|jpeg|gif|bmp) Commented Apr 23, 2012 at 4:09

1 Answer 1

3

@Thoman I assume that the column stores image paths, in which case you could just look for column having the ".jpg", etc. extension as opposed to matching the whole path.

SELECT * FROM `table` WHERE col REGEXP '\.(jpe?g|gif|png)'

If you have the col with values like /tmp/foo.gif then it wouldn't match the \w+ (word characters expression.)

Hope this helps.

Sign up to request clarification or add additional context in comments.

1 Comment

It works perfectly. In case Thoman wants a sample, here is a sqlfiddle. Please ignore me using Zelda links :)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.