note
davido
<p>If you're using locales (which you probably are, if you're dealing with accented characters), Perl's regular expression system is smart enough (usually) to include those accented characters in the \w metacharacter class. You can use this to your advantage. Here's what you need to match:
</p><p><em>
Any character that is <b>not</b> a nonword character, that is not a-z or A-Z nor a numeric digit, nor underscore.</em> That's a mouthful, but here's how it's written:
</p>
<code>
print "$character\n" if $character =~ m/[^\Wa-zA-Z\d_]/;
</code>
<p>That looks a little ugly, so here's a POSIX version that looks cleaner:
</p>
<code>
print "$character\n" if $character =~ m/[^[:^alpha:]a-zA-Z]/;
</code>
<p>
These solutions are not thoroughly tested, as I'm currently sitting at an older operating system that doesn't have much in the way of locale support.
</p>
<div class="pmsig"><div class="pmsig-281137">
<br /><p>Dave</p>
</div></div>
416513
416513