Re: preg for unicode strings?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi 

Thank you for your reply.

My regexp was 

/^([a-zA-Z]{3,}|[\W])/

Meaning match any string that is either
3 letters
or
1 word character

I'd like to change this to
3 letters
or
1 currency character

So I changed the regexp accordingly
/^([a-zA-Z]{3,}|[\p{Sc}])/u

And I tested with £

but it fails.

Any ideas?

With kind regards


Andy

On Sunday 06 November 2005 02:11, Niels Ganser wrote:
> Andy,
>
> you might want to check out
> http://www.regular-expressions.info/unicode.html
>
> Please note two things while using the described syntax:
> 1. You have to additionally use the u modificator.
> 2. While \p{Ll} for instance works in PHP, \p{Lowercase_Letter} doesn't.
>
> Regards,
> Niels
>
> > Hi List
> >
> > I am doing some data validation and the following regexp fails
> >
> > [\W]
> >
> > When using characters like £ or €
> >
> > Obviously because they are technically more then one character, even
> > though they are only displayed as one.
> >
> > The script is encoded in UTF-8
> >
> > Anybody know a fix for this?
> >
> > With kind regards
> >
> >
> > Andy

-- 
Now listening to Top! Radio Live www.topradio.be/stream on amaroK
Geek code: www.vlaamse-kern.com/geek
Registered Linux User No 379093
If life was for sale, what would be its price?
www.vlaamse-kern.com/sas/ for free php utilities
--

Attachment: pgp3h0uoRxjFO.pgp
Description: PGP signature


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux