I need some regex that will match only numbers that are decimal to two places. For example:
It depends a bit on what shouldn't match and what should and in what context
for example should the text you test against only hold the number? in that case you could do this:
/^[0-9]+\.[0-9]{2}$/
but that will test the entire string and thus fail if the match should be done as part of a greater whole
if it needs to be inside a longer styring you could do
/[0-9]+\.[0-9]{2}[^0-9]/
but that will fail if the string is is only the number (since it will require a none-digit to follow the number)
if you need to be able to cover both cases you could use the following:
/^[0-9]+\.[0-9]{2}$|[0-9]+\.[0-9]{2}[^0-9]/