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
Solved

Need Regex Money No $

Posted on 2016-09-21
5
80 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 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:charlesbaldo
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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Whatever be the reason, if you are working on web development side,  you will need day-today validation codes like email validation, date validation , IP address validation, phone validation on any of the edit page or say at the time of registration…
Problem Hi all,    While many today have fast Internet connection, there are many still who do not, or are connecting through devices with a slower connect, so light web pages and fast load times are still popular.    If your ASP.NET page …
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…

856 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