News Feed
Sections




News Archive
Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

Padraic Brady's Blog:
PCRE Regex Word Matching "w" vs "a-zA-Z0-9_"
December 28, 2009 @ 09:41:21

Padraic Brady has posted about an issue he noticed when working with regular expressions and the "word" character type to find something that's alpha-numeric (including an underscore):

You can find the "word" generic character type used in a lot of PHP code including the Zend Framework. The problem is that the assumption above is incorrect. Now, most of the time these act identically because PHP is compiled using its own packaged PCRE library. However, I've seen more than once systems where this is not the case. Usually in some non-English capacity where additional locale support was considered necessary or standard practice.

The problem comes when PHP is compiled against a custom PCRE library, making it more locale-aware. He gives instructions on how to get this to a testable state on your environment (using an updated PREC library) and get it working for characters in French, like the accented "a" or "e".

0 comments voice your opinion now!
pcre regularexpression locale french


blog comments powered by Disqus

Similar Posts

PHPFreaks.com: PCRE Regex Spotlight: \K

Pierre-Alain Joye's Blog: Finally some new features are coming, zip-1.9.0 serie began

Paul Jones' Blog: Solar 0.27.0 and 0.27.1 Released

Padraic Brady's Blog: PCRE Regex Word Matching: "\w" vs "a-zA-Z0-9_"

DevShed: Working with Regular Expressions with Filters in PHP 5


Community Events

Don't see your event here?
Let us know!


series framework voicesoftheelephpant podcast php7 interview install community introduction symfony2 performance release laravel example application conference opinion api configure language

All content copyright, 2015 PHPDeveloper.org :: info@phpdeveloper.org - Powered by the Solar PHP Framework