views:

264

answers:

2

I have a page that I want to set as a goal in Google Analytics but there is a part of the URL that will be a random numnber (xxxxx). How do I specify such a URL with regex?

/products/sf/cart/rf/xxxxx/f/477

+1  A: 

If the rest is always the same, just:

/products/sf/cart/rf/(\d+)/f/477
epost
+2  A: 

If the number of digits is fixed and you don't need to grab it:

$pattern = "/\/products\/sf\/cart\/rf\/\d{5}\/f\/477/i";

If you don't care about the number of digits:

$pattern = "/\/products\/sf\/cart\/rf\/\d+\/f\/477/i";

EDIT: I threw in the i flag because you don't want it to be case-sensitive.

Knix