0

I want to change below php regex for java script regex to use them in spry validation framework. 1)"/^[\d]+$/"
2)"/^([\x{600}-\x{6FF}]+\s)*[\x{600}-\x{6FF}]+$/u"
3)"/^([\x{600}-\x{6FF}]+\d*\s)*[\x{600}-\x{6FF}]+\d*$/u"
I don't know difference between php format and javascript format in above regexs.

fire boy
  • 163
  • 2
  • 11

1 Answers1

0

Regex patterns in PHP are enclosed in quotations AND delimiters such as // or @@. In javascript, regex patterns don't need to be enclosed in strings.

If that's not the problem, then you need to post more code for us to help.

In PHP:

preg_match('/hello/','hello world');

In javascript:

'hello world'.match(/hello/);
mowwwalker
  • 16,634
  • 25
  • 104
  • 157
  • i want to check full name in spry framework but i can't use above pattern. with above format spry doesn't allow to use type his/her full name. i want to use persian unicode for fullname. persian unicode is [\u0600-\u06FF] – fire boy Jan 30 '12 at 02:00
  • 1
    @fireboy - So are you saying the problem is the Persian Unicode stuff? Or JavaScript format versus PHP format regexes? – nnnnnn Jan 30 '12 at 02:30
  • my problem is JavaScript format vs PHP format regex. i can't use /^[a-zA-Z]+\s[a-zA-Z]+$/ in spry framework. – fire boy Jan 30 '12 at 10:25