Author: sarathmn | Posted on: 7/29/2009 10:28:36 AM | Views : 442

Hi,
I am new to regular expressions.I have to validate a string in javascript. I have to use regular expression for this purpose
1) Maximum length of the string should be 8
2) The string can contain zero or one letter (A-Z or a-z). If a letter is present it should be only the first character
3) Remaining characters should be numeric(can include decimal also)
4) decimal point should have maximum 2 digits
for e.g --- >
A123 - valid
k123 - valid
123  -- Valid
123.23 -- valid
123.1 - valid
AA234 - Invalid (character is alpha)
123P34- Invalid (only first character can be a alpha/letter character)
123. - Invalid (no numbers after decimal)
1234567890 - Invalid(length greater than 8)


Please help...
regards,
Sarath


...

Go to the complete details ...