473,386 Members | 1,720 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Regular Expression Val problems

I'm trying to allow only numeric characters and a decimal point in a
textbox. According to my RE book [0-9\.] should work but it doesn't - it
will only allow numeric characters. Also the standard [A-Za-z0-9] does not
work- it won't allow any letters?

What am I doing wrong?
Thanks,
T
Nov 20 '05 #1
4 903
Try this one: ^[\d]+\.{1}$

It allows one or more digits followed by exactly one decimal point

"Tina" <ti**********@nospammeexcite.com> wrote in message
news:ub**************@TK2MSFTNGP14.phx.gbl...
I'm trying to allow only numeric characters and a decimal point in a
textbox. According to my RE book [0-9\.] should work but it doesn't - it
will only allow numeric characters. Also the standard [A-Za-z0-9] does not
work- it won't allow any letters?

What am I doing wrong?
Thanks,
T

Nov 20 '05 #2
Unfortunitely, that won't allow any digits after the decimal point.

Also, I still don't understand why [0-9\.] won't allow 9.7 and [A-Za-z0-9]
won't allow AbC98. Seems like something is not working right. (or I have a
bad book)
T
"Siva M" <sh******@online.excite.com> wrote in message
news:OT*************@TK2MSFTNGP10.phx.gbl...
Try this one: ^[\d]+\.{1}$

It allows one or more digits followed by exactly one decimal point

"Tina" <ti**********@nospammeexcite.com> wrote in message
news:ub**************@TK2MSFTNGP14.phx.gbl...
I'm trying to allow only numeric characters and a decimal point in a
textbox. According to my RE book [0-9\.] should work but it doesn't - it
will only allow numeric characters. Also the standard [A-Za-z0-9] does
not
work- it won't allow any letters?

What am I doing wrong?
Thanks,
T

Nov 20 '05 #3
Tina can you show how you are applying the reg exp in your page.
Try looking at:- http://www.regexlib.com/
You should see more patterns
Patrick

"Tina" <ti**********@nospammeexcite.com> wrote in message
news:eQ**************@tk2msftngp13.phx.gbl...
Unfortunitely, that won't allow any digits after the decimal point.

Also, I still don't understand why [0-9\.] won't allow 9.7 and [A-Za-z0-9] won't allow AbC98. Seems like something is not working right. (or I have a bad book)
T
"Siva M" <sh******@online.excite.com> wrote in message
news:OT*************@TK2MSFTNGP10.phx.gbl...
Try this one: ^[\d]+\.{1}$

It allows one or more digits followed by exactly one decimal point

"Tina" <ti**********@nospammeexcite.com> wrote in message
news:ub**************@TK2MSFTNGP14.phx.gbl...
I'm trying to allow only numeric characters and a decimal point in a
textbox. According to my RE book [0-9\.] should work but it doesn't - it will only allow numeric characters. Also the standard [A-Za-z0-9] does
not
work- it won't allow any letters?

What am I doing wrong?
Thanks,
T


Nov 20 '05 #4
I'm using the patterns in the RegularExpressionValidator vs.net tool.

That looks like a very good website. Once I figure out why good patterns
don't always work in the validator tool, I'll be on my way.

thanks,
T
"Patrick.O.Ige" <pa********@optusnet.com.au> wrote in message
news:eU**************@TK2MSFTNGP15.phx.gbl...
Tina can you show how you are applying the reg exp in your page.
Try looking at:- http://www.regexlib.com/
You should see more patterns
Patrick

"Tina" <ti**********@nospammeexcite.com> wrote in message
news:eQ**************@tk2msftngp13.phx.gbl...
Unfortunitely, that won't allow any digits after the decimal point.

Also, I still don't understand why [0-9\.] won't allow 9.7 and

[A-Za-z0-9]
won't allow AbC98. Seems like something is not working right. (or I have

a
bad book)
T
"Siva M" <sh******@online.excite.com> wrote in message
news:OT*************@TK2MSFTNGP10.phx.gbl...
> Try this one: ^[\d]+\.{1}$
>
> It allows one or more digits followed by exactly one decimal point
>
> "Tina" <ti**********@nospammeexcite.com> wrote in message
> news:ub**************@TK2MSFTNGP14.phx.gbl...
> I'm trying to allow only numeric characters and a decimal point in a
> textbox. According to my RE book [0-9\.] should work but it doesn't - it > will only allow numeric characters. Also the standard [A-Za-z0-9]
> does
> not
> work- it won't allow any letters?
>
> What am I doing wrong?
> Thanks,
> T
>
>
>



Nov 20 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Bradley Plett | last post by:
I'm hopeless at regular expressions (I just don't use them often enough to gain/maintain knowledge), but I need one now and am looking for help. I need to parse through a document to find a URL,...
4
by: Neri | last post by:
Some document processing program I write has to deal with documents that have headers and footers that are unnecessary for the main processing part. Therefore, I'm using a regular expression to go...
5
by: Bradley Plett | last post by:
I'm hopeless at regular expressions (I just don't use them often enough to gain/maintain knowledge), but I need one now and am looking for help. I need to parse through a document to find a URL,...
2
by: Brian Kitt | last post by:
I have a process where I do some minimal reformating on a TAB delimited document to prepare for DTS load. This process has been running fine, but I recently made a change. I have a Full Text...
1
by: Shawn B. | last post by:
Greetings, I'm using a custom WebBrowser control: http://www.codeproject.com/KB/miscctrl/csEXWB.aspx When I get the DocumentSource of a web page I browsed, and run a regular expression...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.