How to write regex for string like:
'$12.78..'
I googled and found "re" is the Python module to do it using import re.
But I couldn't figured out the exact way to do it.
How to write regex for string like:
'$12.78..'
I googled and found "re" is the Python module to do it using import re.
But I couldn't figured out the exact way to do it.
As a starter:
import re
print re.match("\$\d\d\.\d+", "$12.1")
print re.match("\$\d\d\.\d+", "12.1")
print re.match("\$\d\d\.\d+", "$123.1")
print re.match("\$\d\d\.\d+", "$12.")
If you want to learn more about regular expressions in Python I recommend: