Regular expression validation

Hi,

I am working on web application VS2003 using C#

I wish to do validate a field in a form using regular expression

The text in the field should be of minimum length 6 and maximum 15 and all should be numeric and must contain dot(.)

and another valiadtion to validate textfield with alphanumeric, there only alphabets and numeric should exists, user should not be able to put any special characters other then space and -

Please guide in writting regular expression

Thanks
tia_kamakshiAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

ozoCommented:
^(?=.*[.])[.0-9]{6,15}$

^[- A-Za-z0-9]{6,15}$
0
tia_kamakshiAuthor Commented:
Thanks for your reply.

This seems good but I have little problem and need your guidence

1. ^(?=.*[.])[.0-9]{6,15}$

--> How did you manage to get that there should be atleast 2 dots in this. If I have to validate that there should be atleast one dot other than 2 dots, then where I should change it

--> Also, If I have to Increase that there should be atleast 3 dots than how this expression will be changed


2. ^[- A-Za-z0-9]{6,15}$

--> Here I do not wanted the minimum and maximum length , I removed {6,15} from expression then it stopped working

Please guide
0
ozoCommented:
If you require 2 dots, that could be
^(?=.*[.].*[.])[.0-9]{6,15}$
for a minimum of 3 dots
^(?=.*[.].*[.].*[.])[.0-9]{6,15}$
or
^(?=(.*[.]){3})[.0-9]{6,15}$

^[- A-Za-z0-9]*$
* is like {0,infinity}
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
tia_kamakshiAuthor Commented:
Thanks, I will test and come back to you.
0
tia_kamakshiAuthor Commented:
Thanks
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Regular Expressions

From novice to tech pro — start learning today.