i want to give regex a pattern and force it to read it all ..
http://example.com/w/2/1/x/some-12345_x.png
i want to target “some-12345_x”
i used this /\/(.*).png/, it doesnt work for some reason
how do i force it to remember it must start with / and end with .png?
If you always want to get the final file-name, minus the extension, you could use PHP’s
substr()instead of trying to come up with a regex:Also, a more readable method would be to use PHP’s
basename():To actually use a regex, you could use the following pattern:
To use this with PHP’s
preg_match():