I have a regular expression that Im using in php:
$word_array = preg_split(
\'/(\\/|\\.|-|_|=|\\?|\\&|html|shtml|www|php|cgi|htm|aspx|asp|index|com|net|o
Don't use a regex to break apart that path. Just use explode
.
$dirs = explode( '/', urldecode($path) );
Then, if you need to break apart an individual element of the array, do that, like on your "pagerank-update" element at the end.
EDIT:
The key is that you have two different problems. First you want to break apart the path elements on slashes. Then, you want to break up the filename into smaller parts. Don't try to cram everything into one regex that tries to do everything.
Three discrete steps:
It is far clearer if you break up your logic into discrete logical chunks rather than trying to make the regex do everything.