Unicode Regular Expression won't work ??

This is a discussion on "Unicode Regular Expression won't work ??" within the JavaScript Forum section. This forum, and the thread "Unicode Regular Expression won't work ?? are both part of the Program Your Website category.



Go Back   Webforumz.com > Main Forums > Program Your Website > JavaScript Forum

Notices


Reply
 
LinkBack Thread Tools
  #1 (permalink)  
Old Jul 24th, 2007, 22:39
New Member
Join Date: Jul 2007
Location: Belgrade
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Unicode Regular Expression won't work ??

HEEEELP ME!

I can't make javascript to validate username form field with unicode characters (charset=utf-8).

PHP that works well on server side:

$legalChars = "/\p{L}|\p{Pc}|\p{N}/"; // allow letters, numbers and underscores
$legalCharsCount = preg_match_all($legalChars,$strng,$blb);
...

JavaScript that drives me crasy:

var error = "";
var illegalChars = /\p{L} \p{Nd}/; //I tried also: / :Lu | :N / and similar expressions without result.
if (illegalChars.test(strng)) { //tried also .match and .seach combinations
error = "The username contains illegal characters.\n";
}

Is ther anyone out-there to know what it is all about ??

Many thanks in advance.
Reply With Quote

  #2 (permalink)  
Old Jul 28th, 2007, 19:16
Ryan Fait's Avatar
SuperMember

SuperMember
Join Date: May 2006
Location: Las Vegas
Posts: 3,786
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Unicode Regular Expression won't work ??

I haven't dabbled with regex and JavaScript much, but you'll need quotes around the illegalChars variable. Hope it's as simple as that!
Reply With Quote
  #3 (permalink)  
Old Jul 28th, 2007, 21:52
New Member
Join Date: Jul 2007
Location: Belgrade
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Unicode Regular Expression won't work ??

Uf, do not work
Actualy, javascript won't accept the reg.ex if it is enclosed in quotes
Reply With Quote
Reply

Tags
form, regular expression, unicode, validation

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
MS Expression radiated Scripts and Online Services 11 Aug 7th, 2007 01:16
Extract attribute value with Regular Expression? ScottDC PHP Forum 2 May 18th, 2007 08:37
Help spliting string by regular expression Sagaris PHP Forum 8 May 1st, 2007 20:46
regular expressions to parse anand1107 JavaScript Forum 1 Mar 21st, 2007 11:32
Need Custom Designer For Regular Work! BlueField Job Opportunities 0 Jun 30th, 2006 23:45


All times are GMT. The time now is 19:25.


Powered by vBulletin®
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC8
© 2003-2008 Webforumz.com : All Rights Reserved

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43