Hi all,

I want to validate a text box like this format 2.0.0_P1416.E1.0_;0 value should be numeric until first two dot after second dot it may contains num, char and special char. I tried with below mentioned special expression but I can’t get my result. Can someone point out what mistake I have done this expression?

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

When I tested with this value 10.1.5_P1416.E_1.0;0 above expersion is not working.

Thanks in advance

An unescaped dot matches any character (except a whitespace if the modifier is not set). You need to use \. to match a dot, instead of just .. Also, you can replace {1,} by + (which means the same: 1 or more).

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.