Reputation: 43
Could someone post some tip on what's the pattern for Regex for postive numeric number with decimal and dollar sign.
Valid:
1.50
25
25.50
$1.50
$25
$25.50
Upvotes: 0
Views: 1040
Reputation: 12912
(\$\s*)?([1-9]\d+|\d+)(\.\d+)?
This one also excludes $05.00
(\$\s*)?(([1-9]\d+|\d+)(\.\d+)?|\.\d+)
This one allows $ .3
Update: to filter 0 and $0
(\$\s*)?(([1-9]\d*)(\.\d+)?|0?\.\d*[1-9]\d*)
Upvotes: 0