Solved

Need Regex Money No $

Posted on 2016-09-21
5
56 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:charlesbaldo
5 Comments
 
LVL 48

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 74

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:charlesbaldo
ID: 41811803
Worked best
0
 
LVL 74

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

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

IntroductionWhile developing web applications, a single page might contain many regions and each region might contain many number of controls with the capability to perform  postback. Many times you might need to perform some action on an ASP.NET po…
Do you hate spam? I do, and I am willing to bet you do as well. I often wonder, though, "if people hate spam so much, why do they still post their email addresses on the web?" I'm not talking about a plain-text posting here. I am referring to the fa…
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…

758 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now