Normally the \w in documentation is written that it does this trick
matching based on the locale that your machine having the pcre installed
use:
http://www.php.net/manual/en/reference.pcre.pattern.syntax.php
" ... 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. For
example, in the "fr" (French) locale, some character codes greater than
128 are used for accented letters, and these are matched by \w.
These character type sequences can appear both inside and outside
character classes. They each match one character of the appropriate
type. If the current matching point is at the end of the subject string,
all of them fail, since there is no character to match. ..."
Therefore your code in this situation will became:
[^\w\s]
Another solution is to get the hex code or the octal code of these special characters and put them into your pattern under this form:
[^a-zA-Z\ddd\ddd\ddd-_\s] where ddd is the octal code
or
[^a-zA-Z\xhh\xhh\xhh-_\s] where hh is the hex code.
----------------------------
Cristian MARIN - cristic@xxxxxxxxxxxxxxxxxx
<mailto:cristic@xxxxxxxxxxxxxxxxxx>
Developer Designers Department
InterAKT Online (www.interaktonline.com <http://www.interaktonline.com>
Patrick wrote:
im trying to get my regular pattern to allow åäöÅÄÖ but it refuses to,
i have something like this:
[^a-zA-ZåäöÅÄÖ0-9-_ ]
But this dosent seem to work, anyone got any ideas?