Question: I have a small, simple, website on which I offer 40 different items with the same pricing structure. I have created a hosted paypal add-to-cart button with that pricing structure, and a dummy "Item Name" and "Item ID".

I then generate an html page for each item that contains a form reference to the hosted button, but adds hidden variables passing the item\_name and item\_number of the individual item. 

The passed item\_name variable successfully overwrites the dummy 'item name' from the hosted button when appearing in the paypal shopping cart, but the passed item\_number variable does not overwrite the dummy 'item id' in the button. I do not see an item\_id variable in the HTML Variables documentation.

It seems logical that I should be able to overwrite 'item id' if I can overwrite 'item\_name', but if the item\_number variable doesn't do it, what does?

Answer: 
Your regular expressions states that after the period character (can be changed to `\.`), you will have zero or more white space characters which should then be followed by 1 *upper case* letter. In your string, you do not have any upper case letters.

Secondly, the `-` should be placed last when you want to match it. So, changing your regex to this: `~\d+[.][\s]*[A-Z]{1}[A-Za-z0-9\s'-]+~` will match something like so: `2.Bon jovi - it's my life`.

On the other hand, you can change it to this: `~\d+[.][\s]*[A-Za-z0-9\s'-]+~` to match something like so: `2.bon jovi - it's my life`.

EDIT: Ammended as per the comments of Marko D and aleation.
Your `[A-Z]{1}` sub-pattern requires one capital letter, so `"2.bon jovi - it's my life"` will not match.

And you need to escape the `-` in the `[A-Za-z0-9\s-']` character class, or put it at the start or end, otherwise it is specifying a range.

```
"~\d+\.[A-Za-z0-9\s'-]+~"

```

As pointed out in the comments, it is actually not necessary to escape the `-` in the character class in your regex. That is only because you happened to precede it with a metacharacter `\s` that cannot be part of a range. Normally, if you want to match a literal `-` and you have it in a character class, you must escape it or position it as described above.