There are multiple posts on here that capture value, but I'm just looking to check to see if the value is something. More vaguely put; I'm looking to understand the difference between checking a value, and "capturing" a value. In the current case the value would be the following acceptable money formats:
Here is a post that explains some about a money regex but I don't understand it a bit.
.50
50
50.00
50.0
$5000.00
$.50
I don't want commas (people should know that's ridiculous).
The thing I'm having trouble with are:
- Allowing for a $ at the starting of the value (but still optional)
- Allowing for only 1 decimal point (but not allowing it at the end)
- Understanding how it's working inside
- Also understanding out to get a normalized version (only digits and a the optional decimal point) out of it that strips the dollar sign.
My current regex (which obviously doesn't work right) is:
# I'm checking the Boolean of the following:
re.compile(r'^[\$][\d\.]$').search(value)
(Note: I'm working in Python)