can someone please help me to compose a regular expression to check a currency string is in a particular format – 300.00
It can have only numbers both before and after the ‘.’. However i want only one occurrance of the ‘.’.
Hence 300.00. or 300.0.0 is invalid.
regards
This means, beginning of string (
^), one or more digits ([0-9]+), optional period (\.?), then 0 or more digits, then the end of the string. You can modify it as needed, e.g. to allow strings beginning with period (change first + to*) or make the period mandatory (remove?).