Re: Regexp trouble

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

 



Andy Pieters wrote:
> 
> Err.. why NOT use character classes?  What is easier  [0-9] or \d or maybe 
> [a-zA-Z] or [\w], ... ?
> 

Well, first of all the square brackets in [\w] aren't needed, \w already
means 'any "word" character'.

Secondly, [a-zA-Z] is not the same as \w:
" A "word" character is any letter or digit or the underscore character,
that is, any character which can be part of a Perl "word". The
definition of letters and digits is controlled by PCRE's character
tables, and may vary if locale-specific matching is taking place (see
"Locale support" above). For example, in the "fr" (French) locale, some
character codes greater than 128 are used for accented letters, and
these are matched by \w. "
[http://www.php.net/manual/en/reference.pcre.pattern.syntax.php]

Anyway I'm not really a great RegExp expert, a good starting point for
understanding regexp and PHP is, as usual, the manual:
http://www.php.net/manual/en/reference.pcre.pattern.syntax.php

Bye!

-- 
tradeOver | http://www.tradeover.net
...ready to become the King of the World?

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[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