I am trying to obtain a number with a decimal point using regex, i have this string where the number in question is
RewriteRule ^additem/[0-9]+(\.[0-9]{1,2})?$additem.php?price=$1
However if I enter 2.02, the stored variable is .02. What am I doing wrong?
You need to add a space between the pattern and the replacement, and use a capturing group around the whole float value pattern:
RewriteRule ^additem/([0-9]+(?:\.[0-9]{1,2})?)$ additem.php?price=$1
^ ^^ ^^^
See the regex demo