Wrox Home  
Search P2P Archive for: Go

  Return to Index  

javascript thread: regex help?


Message #1 by "bryan" <bry@i...> on Wed, 5 Jun 2002 09:53:56 +0200
Hello Greg,

Greg Hill wrote:

>Subject: Re: regex help?
>From: Greg Hill <ghill@s...>
>Date: Thu, 6 Jun 2002 12:42:16 -0700
>X-Message-Number: 8
>
>Bryan,
>
>\p{Sc}\p{Nd}+(\.\p{Nd}\p{Nd})?
>
>is the strangest "regular expression" I have ever seen.  It does not 
>conform to any regular expression syntax that I am aware of, and it 
>does not work on the browser I use.  In particular, I have never seen 
>the constructs "\p" or "{Sc}" or "{Nd}" before.  Is there an English 
>language reference for that syntax that you could point me to?
>
The regular expression syntax he was using looks similiar to the one for 
Unicode. The \p is an abbreviation for Character Property which is a 
meta-specification format which is kind of like the [:alpha:] 
designations you see in Perl. Since the Unicode properties are a little 
more verbose than normal this syntax was proposed by the Unicode 
Standard for Re Engines. So something like [\p{Nd}] is an abbreviation 
for a Unicode general property for Decimal Digit Number, see how verbose 
they are,  and would be similiar to [:digit:] in most Perl Re's.

The specification is over on the Unicode site at 
http://www.unicode.org/unicode/reports/tr18/

John



  Return to Index