I have a site that has an Apache redirect. I need to replicate this regex in Java to scrub some URL's from the same server.

This is Apache redirect:

```
RedirectMatch 301 ^/([0-9]{4})/([0-9]{2})/([0-9]{2})/(.*)$ http://example.com/$4

```

How do I use this in Java so I can do something like this, so it will adjust the string if it needs to or leave it alone if it doesn't match?:

```
String url = "http://example.com/2012/04/06/somepage"
url.replaceAll(?, ?); // Result should be: http://example.com/somepage

```