I need to edit a textbox for numeric and may contain up to 1"." (decimal pt). I want to check for one decimal that could be anywhere in the 15 characters. Must be numeric except for the decimal. Can only have 1 decimal max but does not have to have 1. Any number of characters up to 15.
(*[0-9A-Za-z]+\.[[0-9A-Za-z][0-9A-Za-z]*){3, 15}
use in a custom validator
silemone
(*[0-9A-Za-z]+\.[0-9A-Za-z][0-9A-Za-z]*){3, 15}
use in a custom validator
oops...Regular expression that states any amount of letters that have at least one digit or letter (alphanumeric in front, followed by a period, followed by at least one alphanumeric and therefore you must have at least 3 characters and up to 15.
silemone
(*[0-9A-Za-z]+[.]{0,1}[0-9A-Za-z][0-9A-Za-z]*){3, 15}
use in a custom validator
Just read your statement clearer...this is same as above except there can be 1 or less periods
my regular expression is wrong...i'm trying to figure this one out.
garyinmiami2003
ASKER
It does not have to be just 1 edit. Must catch anything non numeric and allow only "."
silemone
yep and that's what regular expressions are good for, pattern matching...basically the patterns are
1
11
111
1a1 up to fifteen characters
but when the decimal comes into play, that when the problem occurs because that must at least one alphanumeric in front of the decimal and i would think one after....i.e. pattern if there's a decimal:
x.x can't be .x or x. where x = a-z, 0-9, etc.
problem is i can make a regular expression for this but it will be pretty long... because you have to consider when there's not a set number of decimals in front of the decimal nor in back. so you have a lot of cases to consider... what programming language are you using by the way?
.....
i'm actually doing a programs to work with the regular expression. Another option you have to separate the string, but that's more code than needed...but as a last result that will be the way to go.
silemone
here's the regular expression: ^[0-9A-Za-z]{1,15}([.]{0,1}[0-9A-Za-z]{1,13})*$
use in a custom validator