You are here: Re: [PHP] Regexp trouble « PHP « IT news, forums, messages
Re: [PHP] Regexp trouble

Posted by Frank Armitage on 11/24/05 23:40

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?

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация