-2

i want to allow only characters X,N,-,(Space) to string which user inputs.

Ex : XXXX-NNNNN XXXXXX-NNNN is valid string but Ex XXXx-1NNN XXXX-NNNN is not valid string.

I have found so many regexp for that but didn't find helpful solution

I want this solution in zend form

Yogesh
  • 597
  • 2
  • 5
  • 18
  • Please consider taking a look at the [The Stack Overflow Regular Expressions FAQ](http://stackoverflow.com/a/22944075/2736496). – aliteralmind Sep 27 '14 at 12:22

1 Answers1

0

Try this:

preg_match("/^[XN -]+$/", $string);
Amir
  • 40
  • 5