I am trying to implement a php script which will run on every call to my site, look for a certain pattern of URL, then explode the URL and perform a redirect.

Basically I want to run this on a new CMS to catch all incoming links from the old CMS, and redirect, based on mapping, say an article id stripped form the URL to the same article ID imported into the new CMS's DB.

I can do the implementation, the redirect etc, but I am lost on the regex.

I need to catch any occurrences of:

`domain.com/content/view/*/34/` or `domain.com/content/view/*/30/` (where \* is a wildcard) and capture `*` and the `30` or `34` in a variable which I will then use in a DB query.

If the following is encountered:

> 
> `domain.com/content/view/*/34/1/*/`
> 
> 
> 

I need to capture the first `*` and the second `*`.

Be very grateful for anyone who can give me a hand on this.