LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 04-01-2005, 07:30 AM   #1
aunquarra
LQ Newbie
 
Registered: Jan 2005
Distribution: Slackware 10.1
Posts: 28

Rep: Reputation: 15
regex matching things like å õ í ë ã è, etc.


I'm working on a spam filtering script written in perl (which I'm just beginning to learn anyway), and I've gotten pretty fair with pattern matching, but something just stumped me.

How do I match special characters like å, ¿, è, and so forth? When I paste into my telnet client (CRT), it appears as \345, or whatever the proper code is for that character, which I thought would be sufficient. Then I tested it, and it didn't work...

So, then I googled a bit, and saw where someone said that /[à-öø-ÿ]/ should match any of them... And yeah, same thing happened.

So maybe it's not as much a problem with my programming, but my telnet client, or something... Any help please?
 
Old 04-01-2005, 09:29 AM   #2
keefaz
LQ Guru
 
Registered: Mar 2004
Distribution: Slackware
Posts: 6,552

Rep: Reputation: 872Reputation: 872Reputation: 872Reputation: 872Reputation: 872Reputation: 872Reputation: 872
The regex matching the character hex value should work just fine

Code:
keefaz:~$ perl -e '
$s = "å";
$s =~ s/\345/a/;
print "$s\n";
'
a
keefaz:~$
Also, try man iso_8859-15 for hex values

Last edited by keefaz; 04-01-2005 at 09:30 AM.
 
Old 05-04-2005, 07:53 AM   #3
aunquarra
LQ Newbie
 
Registered: Jan 2005
Distribution: Slackware 10.1
Posts: 28

Original Poster
Rep: Reputation: 15
Gah!

You suggestion worked in my tests (using http://www.quanetic.com/regex.php to tinker), but for some reason it's not working in the real deal (in mimedefang, if you're curious). I'll have to look into it further.

Thanks for the help.
 
  


Reply



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 On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Find/grep command to find matching files, print filename, then print matching content stefanlasiewski Programming 9 06-30-2016 05:30 PM
Suse: confused on many things, why is installing things so hard? blackflare Linux - Newbie 11 10-16-2007 04:35 AM
Regex Help cmfarley19 Programming 5 03-31-2005 10:13 PM
perl regex matching exodist Programming 2 11-15-2004 10:50 PM
regex stumper Silly22 Programming 4 07-07-2002 05:10 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 02:34 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration