php - Money Regex, Optional dollar sign -


I am trying to explain how the dollar sign is optional to validate the dollar amount.

Current expression:

  Public stable work is ValidDollars ($ amount) {if (preg_match ("/ ^ [0-9] * (\ [0-9] [0-9]] $ / ", $ amount} {return true;} and {return false;}}  

If I do not work in the beginning" \ $ \? " I know that to save the dollar sign, I'm not sure what I'm missing because it's very easy.

Comments

Popular posts from this blog

import - Python ImportError: No module named wmi -

Editing Python Class in Shell and SQLAlchemy -

c# - MySQL Parameterized Select Query joining tables issue -