Hi every one,

I have a text field called control. This field should allow the following kind of values.

             1) 1.2.3;4              : a) If I give some other value I should show error 
             2) 1.2.1_a.te.st_;6     : b) Here when I enter '_' then its mandatory to  enter some char or no's next to '_'. For second '_' its not necessary to enteranything.
                                       c) Need to block continous two dot like this(1.2.3...1;5)   

Which means I need to check the validation after second dot (.) to (;) I can enter dot(.),char, no's , '_' and want to apply the mentioned conditions(b) also.

I tried out this reg exp but I don't know how to add conditions in that. Can anyone tell me how to do this validation?

/[0-9]{1,}.[0-9]{1,}.[0-9a-zA-Z._']{1,};[0-9a-zA-Z]{1,}/g;

Thanks in advance,

Member Avatar for stbuchok

You might want to look at using the | (pipe) which is used like an or. I tend to use this site a lot for regex stuff (I always forget what does what): http://www.regular-expressions.info/reference.html

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.