Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 126
  • Last Modified:

Need Regex Money No $

Please I need a reg ex that will do Money without the $

numbers only
commas in right place
2 dp
no $
0
Charles Baldo
Asked:
Charles Baldo
1 Solution
 
Rgonzo1971Commented:
Hi,

pls try
(([0-9]{1,3}),?.?\d{0,2})(([0-9]{1,3})?,?.?\d{0,2})?(\.\d{0,2})?

Open in new window

REgards
0
 
Dustin SaundersDirector of OperationsCommented:
If it has a $ on it, then it's a string right?  Why not just use:

string.replace("$",string.Empty)

Open in new window


or
string.Substring(1)

Open in new window

0
 
käµfm³d 👽Commented:
^\d{1,3}(,\d{3})*(\.\d\d)?$

Open in new window


If you don't want the decimal part to be optional, then remove the ?
0
 
Charles BaldoSoftware DeveloperAuthor Commented:
Worked best
0
 
käµfm³d 👽Commented:
I fail to see how considering it allows things like:

1,000,0.00
1

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now