Reputation: 4866
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
Upvotes: 1
Views: 1130
Reputation: 4038
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.
Upvotes: 2
Reputation: 51
If the rest is always the same, just:
/products/sf/cart/rf/(\d+)/f/477
Upvotes: 3