Re: Strings with extended characters

2004-04-01 Thread Daniel Staal
--As of Thursday, April 1, 2004 9:58 AM -0500, [EMAIL PROTECTED] is 
alleged to have said:

Is there a simple way to reject any string that has extended characters
in  it? In other words, only accept the 88 (I think it's 88) regular
keyboard  characters and numbers. I can't find a simple way to do this.
--As for the rest, it is mine.

I'm sure there is a smart way, but here's a dumb idea:

my @characters = unpack('U*', $string);
for @characters {
   if $_ > $max_Char_Value {
   # Do something
   } else
   # Do something else.
   }
}
Daniel T. Staal

---
This email copyright the author.  Unless otherwise noted, you
are expressly allowed to retransmit, quote, or otherwise use
the contents for non-commercial purposes.  This copyright will
expire 5 years after the author's death, or in 30 years,
whichever is longer, unless such a period is in excess of
local copyright law.
---
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
 



RE: Strings with extended characters

2004-04-01 Thread Jayakumar Rajagopal
Jim
Please send two sample strings one that contains 'reject'able stuff, and other with 
those 88. That would clarify us better.
Jay
-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
Sent: Thursday, April 01, 2004 9:58 AM
To: [EMAIL PROTECTED]
Subject: Strings with extended characters



Is there a simple way to reject any string that has extended characters in 
it? In other words, only accept the 88 (I think it's 88) regular keyboard 
characters and numbers. I can't find a simple way to do this.

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
 




Re: Strings with extended characters

2004-04-01 Thread JupiterHost.Net


[EMAIL PROTECTED] wrote:

Is there a simple way to reject any string that has extended characters in 
it? In other words, only accept the 88 (I think it's 88) regular keyboard 
characters and numbers. I can't find a simple way to do this.

Does this help?
 if($string !~ m/^\w+$/) { die "I hate extended characters"; }
Of course \w+ is letters , numbers, and underscores only, you will need 
to add any other characters you want tot he regex but that should get 
you started eh?

Lee.M - JupiterHost.Net

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
 



Re: Strings with extended characters

2004-04-02 Thread John W. Krahn
[EMAIL PROTECTED] wrote:
> 
> Is there a simple way to reject any string that has extended characters in
> it? In other words, only accept the 88 (I think it's 88) regular keyboard
> characters and numbers. I can't find a simple way to do this.

if ( $string =~ /[^[:print:]]/ ) {
print "This string has invalid characters in it.\n";
}


John
-- 
use Perl;
program
fulfillment

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]