PHP Tutorial - PHP preg_replace URL not working

I have the following URL structure:
http://website.com/wordpress/2012/04/permalink-string-string/
I want to get rid of /2012/04
I tried this:
$cont = preg_replace('http:\\/\\/website\\/.com\\/wordpress\\/[0-9]{4}\\/[0-9]{2}\\/', 'http://website.com/', $cont);
I double-escaped the backslash...
I tried samples from other topics and not getting any result. Just empty $cont.
Thanks!
Answer:
You had one extra /, didn't have starting and ending slashes and you never escaped the dot which means that it could accept anything in the place of the dot. However, here's the working code:
$cont = "http://website.com/wordpress/2012/04/permalink-string-string/";
$cont = preg_replace('/http:\/\/website\.com\/wordpress\/[0-9]{4}\/[0-9]{2}\//', 'http://website.com/', $cont);
print_r($cont);
This prints http://website.com/permalink-string-string/
Answer:
Your regex could probably be simplified a bit with a negative lookahead assertion
$cont = preg_replace('/.*?\/(?!.*\/)/', 'http://www.website.com/wordpress/', $cont);
That'll fetch everything up to the last instance of a forward slash.