I have been struggling for a couple of hours now trying to write a preg_match expression to validate a dollar amount - the user may or may not put in the decimals so I want to allow only digits plus a possible period followed by two more digits. My eyes are now swimming and I just can't seem to get right. This is what I have at the moment:
if (!preg_match("/[\d]+([\.]{1}[\d]{2})?/", $form_data[amount])) // wrong amount but it still allows invalid input. Can anyone help or is there a better way to do it? Thanks Steve