Regex to certain special characters -


currently have following regex use validate name of company/industry , working fine

  /(?=[a-za-z0-9-]{5,25}$)^[a-za-z0-9]+(-[a-za-z0-9]+)*$/ 

the above regex doesnt supports special characters & - . _ valid in case

i came wasnt working expected.

 /(?=[a-za-z0-9-\&\_\.]{5,25}$)^[a-za-z0-9\&\_\.]+(-[a-za-z0-9\&\_\.]+)*$/ 

can point out above regex goes wrong. short explaination of above regex wud appreciated thanks

i don't think have escape & \&, same way _ also

/(?=[a-za-z0-9-&_\.]{5,25}$)^[a-za-z0-9&_\.]+(-[a-za-z0-9&_\.]+)*$/ 

Popular posts from this blog

Php - Delimiter must not be alphanumeric or backslash -

c# - How to change the "Applies To" field under folder auditing options programatically (.NET) -

c++ - Ambiguity when using boost::assign::list_of to construct a std::vector -