I hope you can help me create a regex that will extract the image name from a url. I've been trying to create the regex for a couple of days now but i cant get it to work.
The case:
I have an image url created with phpThumb that looks like this:
\bla\thumb\phpThumb.php?src=/bla/images/thisistheimage.jpg&fltr[]=wmt|40|B|FFFFFF|georgia.ttf|35&hash=b7412f04f09cd6b488435231651d61453
No i need the following extracted: thisistheimage.jpg
Some facts:
- there is always a "/" in front of the image name;
- the image name is always followed by an amp (&);
- the image extention can also be: jpeg, JPG, png, PNG, gif;
All i have managed to grab was the image extension with (?:png|jpg|gif).
Can you please help me what regex I have to use in this case?
I'm able to use the regex in javascript or in PHP, where do you recommend it? (I use javascript to submit the form and the form action is done in PHP).