PCRE - National characters

This is a discussion on PCRE - National characters within the PHP General forums, part of the PHP Programming Forums category; Hi :) Now have i tried to solve my reg exp problem - but nothing seems to work. I want to find ...


Go Back   Usenet Forums > PHP Programming Forums > PHP General

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 02-11-2006
Johan Holst Nielsen
 
Posts: n/a
Default PCRE - National characters

Hi :)

Now have i tried to solve my reg exp problem - but nothing seems to work.

I want to find all non-letter chacters of a word - and replace it with
nothing. It seems to work - but when I begin to add national characters
to the strings - it doesnt work...

A simple part of it could like like this

<?php
$foo = "ęble";
$bar = "Ja?";
echo preg_replace('/\W*/', '\1', $foo); //returns ble - hould return ęble
echo preg_replace('/\W*/', '\1', $bar); //returns Ja
?>

Isnt there a way to solve this problem? Or is \w limited to a-z?

:)

Regards,
Johan
Reply With Quote
  #2 (permalink)  
Old 02-12-2006
nemesis_17
 
Posts: n/a
Default Re: PCRE - National characters

Funny, never realized that national characters were a part of the word
characters lot. You might want to try:

<?php
$foo = "ęble";
$bar = "Ja?";
echo preg_replace('/[^a-zA-Z]*/', '\1', $foo)."\n"; //returns ble
echo preg_replace('/[^a-zA-Z]*/', '\1', $bar)."\n"; //returns Ja
?>

--Nitin

Reply With Quote
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +1. The time now is 11:37 PM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0