I'm struggling with the regular expression syntax needed to simply transform this string:
posts/2012-03-16-23-07_an-awesome-post.md
into this string:
an-awesome-post
using the preg_replace() PHP function. Here's what I've got so far:
preg_replace('posts/[0-9-]*_([a-z-]*).md', '$1', 'posts/2012-03-16-23-07_an-awesome-post.md');
No dice. When I assign the result to a variable and echo() out that variable, I get nothing. My regex syntax is a bit rusty, but Googling around a bit makes me think that, at the very least, I'm on the right track.