Solved

Need Regex Money No $

Posted on 2016-09-21
5
83 Views
Last Modified: 2016-09-23
Please I need a reg ex that will do Money without the $

numbers only
commas in right place
2 dp
no $
0
Comment
Question by:Charles Baldo
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
5 Comments
 
LVL 50

Accepted Solution

by:
Rgonzo1971 earned 500 total points
ID: 41808641
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
 
LVL 12

Expert Comment

by:Dustin Saunders
ID: 41808758
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
 
LVL 75

Expert Comment

by:käµfm³d 👽
ID: 41809345
^\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
 

Author Closing Comment

by:Charles Baldo
ID: 41811803
Worked best
0
 
LVL 75

Expert Comment

by:käµfm³d 👽
ID: 41812404
I fail to see how considering it allows things like:

1,000,0.00
1

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Just a quick little trick I learned recently.  Now that I'm using jQuery with abandon in my asp.net applications, I have grown tired of the following syntax:      (CODE) I suppose it just offends my sense of decency to put inline VBScript on a…
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…

726 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question