I want to write a regular expression which will take the characters from the last "slash" "/" to the right.
Exemple1 : http:// thesite.com/tester/blabla/this_is_the.jpg - I want to extract only the "this_is_the.jpg" Exemple2 : http:// thesite.com/tester/blabla/this_is_2.jpg - Only the "this_is_2.jpg"
It's as simple as:
[^/]+$
Which basically says: "give me all characters at the end that are not slashes".
Example:
$ echo 'http:// thesite.com/tester/blabla/this_is_the.jpg' | egrep -o '[^/]+$'
this_is_the.jpg
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With