accentuated character - RE

N

nicolas_laurent545

Hi

(\w+) does not see accentuated character such as (é).
[a-zé] sees accentuated character but the problem is that I have to
enumerate èîô etc.

Is there any other method in regular expression to include accentuated
character so I do not
need to specify them in advance ?

Thanks
 
J

John W. Krahn

(\w+) does not see accentuated character such as (é).
[a-zé] sees accentuated character but the problem is that I have to
enumerate èîô etc.

Is there any other method in regular expression to include accentuated
character so I do not
need to specify them in advance ?

Put this line near the top of your program:

use locale;


perldoc locale
perldoc perllocale
etc.


John
 
G

Gunnar Hjalmarsson

John said:
(\w+) does not see accentuated character such as (é).
[a-zé] sees accentuated character but the problem is that I have to
enumerate èîô etc.

Is there any other method in regular expression to include accentuated
character so I do not
need to specify them in advance ?

Put this line near the top of your program:

use locale;

Or, possibly better, in the smaller block where that behaviour is desired.
 
D

Dave


(\w+) does not see accentuated character such as (é).
[a-zé] sees accentuated character but the problem is that I have to
enumerate èîô etc.
Is there any other method in regular expression to include accentuated
character so I do not
need to specify them in advance ?

You would be better off using (\p{IsAlpha}+). This will get all Alphabetical
characters.
See the docs on Unicode.
 
G

Gunnar Hjalmarsson

Dave said:
(\w+) does not see accentuated character such as (é).
[a-zé] sees accentuated character but the problem is that I have to
enumerate èîô etc.
Is there any other method in regular expression to include accentuated
character so I do not need to specify them in advance ?

You would be better off using (\p{IsAlpha}+).

How can you tell?
 
D

Dave

Gunnar Hjalmarsson said:
Dave said:
(\w+) does not see accentuated character such as (é). [a-zé] sees
accentuated character but the problem is that I have to enumerate èîô
etc.
Is there any other method in regular expression to include accentuated
character so I do not need to specify them in advance ?

You would be better off using (\p{IsAlpha}+).

How can you tell?

Fair point I should have had the word 'probably' in that sentence as from
the original post (which, as you correctly imply, does not give the OP's
actual goal) I am assuming he is trying to use (\w+) to capture whole words
(in a natural language) but is finding that it does not work well for this.
I should have made my assumption explicit. Thanks for pointing this out.
(Your suggesting of adding use locale; makes similar assumptions it has to
be said.)
 
G

Gunnar Hjalmarsson

Dave said:
Gunnar said:
Dave said:
(\w+) does not see accentuated character such as (é). [a-zé] sees
accentuated character but the problem is that I have to enumerate èîô
etc.

Is there any other method in regular expression to include accentuated
character so I do not need to specify them in advance ?

You would be better off using (\p{IsAlpha}+).

How can you tell?

Fair point I should have had the word 'probably' in that sentence as from
the original post (which, as you correctly imply, does not give the OP's
actual goal) I am assuming he is trying to use (\w+) to capture whole words
(in a natural language) but is finding that it does not work well for this.
I should have made my assumption explicit. Thanks for pointing this out.
(Your suggesting of adding use locale; makes similar assumptions it has to
be said.)

Not really. I just meant that we don't really know whether he is
interested in also matching digits. ;-)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,055
Latest member
SlimSparkKetoACVReview

Latest Threads

Top