Thanks for your followup Dev,
For the regex you mentioned:
============
I used this one for the positive number :- ([0-9]+[,]*)+[.]{0,1}([0-9]*)
And
For the negative numbers :- [-]{0,1}([0-9]+[,]*)+[.]{0,1}([0-9]*)
==============
for general validation, it's ok. However, we can find that such regex won't
validate the comma 's position(we can insert discretionary commas in any
place), e.g:
2,3,4,5.34 is also valid through it.
Anyway, I don't think there will be a completely perfect regex, but you can
have a look in the
www.regexlib.com I mentioned in the last reply since there're many existing
sophisticate ones we can refer to.
Thanks,
Steven Cheng
Microsoft Online Support
Get Secure!
www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)
--------------------
| From: "msnews.microsoft.com" <
[email protected]>
| References: <O8bn#
[email protected]>
<
[email protected]>
<
[email protected]>
| Subject: Re: Hi - Regular Expression
| Date: Tue, 13 Sep 2005 12:33:34 +0100
| Lines: 113
| X-Priority: 3
| X-MSMail-Priority: Normal
| X-Newsreader: Microsoft Outlook Express 6.00.2900.2180
| X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180
| X-RFC2646: Format=Flowed; Original
| Message-ID: <#
[email protected]>
| Newsgroups: microsoft.public.dotnet.framework.aspnet.webcontrols
| NNTP-Posting-Host: 217.205.201.142
| Path: TK2MSFTNGXA01.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGP14.phx.gbl
| Xref: TK2MSFTNGXA01.phx.gbl
microsoft.public.dotnet.framework.aspnet.webcontrols:10810
| X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet.webcontrols
|
| Hi Steven
|
| Thanks
|
| I used this one for the positive number :- ([0-9]+[,]*)+[.]{0,1}([0-9]*)
| And
| For the negative numbers :- [-]{0,1}([0-9]+[,]*)+[.]{0,1}([0-9]*)
| Which I guess is simpler for me to understand and debug..
|
| Hey do you think there will be any possible entries which can break this
| RegEx
| Do reply.
|
| Thanks
| dev
|
|
| | > Hi Dev,
| >
| > Have you got any progress on this issue or does the things in my last
| > reply
| > helps a little? If there're any further things we can help, please feel
| > free to post here.
| >
| > Thanks,
| >
| > Steven Cheng
| > Microsoft Online Support
| >
| > Get Secure!
www.microsoft.com/security
| > (This posting is provided "AS IS", with no warranties, and confers no
| > rights.)
| > --------------------
| > | X-Tomcat-ID: 65295968
| > | References: <O8bn#
[email protected]>
| > | MIME-Version: 1.0
| > | Content-Type: text/plain
| > | Content-Transfer-Encoding: 7bit
| > | From: (e-mail address removed) (Steven Cheng[MSFT])
| > | Organization: Microsoft
| > | Date: Wed, 07 Sep 2005 01:38:13 GMT
| > | Subject: RE: Hi - Regular Expression
| > | X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet.webcontrols
| > | Message-ID: <
[email protected]>
| > | Newsgroups: microsoft.public.dotnet.framework.aspnet.webcontrols
| > | Lines: 41
| > | Path: TK2MSFTNGXA01.phx.gbl
| > | Xref: TK2MSFTNGXA01.phx.gbl
| > microsoft.public.dotnet.framework.aspnet.webcontrols:10758
| > | NNTP-Posting-Host: tomcatimport2.phx.gbl 10.201.218.182
| > |
| > | Hi Dev,
| > |
| > | Welcome to ASPNET newsgroup.
| > | As for the regex question you mentioned, here is a simple one which
can
| > | meet the general requirement for validating a number with commas and
| > | decimal point:
| > |
| > | ^(\d{1,3}(\,\d{3})*|(\d+))(\.\d{0,2})?$
| > |
| > | Also, since it's hard to find a perfect one, I suggest you try having
a
| > | look at the
| > |
| > |
www.regexlib.com which contains much existing regex resources and
| > patterns.
| > |
| > | Hope helps, Thanks,
| > |
| > | Steven Cheng
| > | Microsoft Online Support
| > |
| > | Get Secure!
www.microsoft.com/security
| > | (This posting is provided "AS IS", with no warranties, and confers no
| > | rights.)
| > |
| > | --------------------
| > | | From: "msnews.microsoft.com" <
[email protected]>
| > | | Subject: Hi - Regular Expression
| > | | Date: Tue, 6 Sep 2005 12:38:23 +0100
| > | | Lines: 11
| > | | X-Priority: 3
| > | | X-MSMail-Priority: Normal
| > | | X-Newsreader: Microsoft Outlook Express 6.00.2900.2180
| > | | X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180
| > | | X-RFC2646: Format=Flowed; Original
| > | | Message-ID: <O8bn#
[email protected]>
| > | | Newsgroups: microsoft.public.dotnet.framework.aspnet.webcontrols
| > | | NNTP-Posting-Host: 217.205.201.142
| > | | Path:
TK2MSFTNGXA01.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGP12.phx.gbl
| > | | Xref: TK2MSFTNGXA01.phx.gbl
| > | microsoft.public.dotnet.framework.aspnet.webcontrols:10747
| > | | X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet.webcontrols
| > | |
| > | | Hi,
| > | | I want to put regular expression for a text box which is numeric. [
| > e.g.
| > | | 1,500,000.25 ]
| > | | the characters like dot, comma and 0-9 are allowed for the same.
| > | | Can anyone post the regexp.
| > | |
| > | | Thanks
| > | |
| > | | dev
| > | |
| > | |
| > | |
| > |
| > |
| >
|
|
|