Professional Web Applications Themes

Strings with extended characters - PERL Beginners

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....

  1. #1

    Default 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.

    Jimstone77@aol.com Guest

  2. #2

    Default Re: Strings with extended characters



    com wrote:
     

    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

    Jupiterhost.Net Guest

  3. #3

    Default RE: Strings with extended characters

    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: com [mailto:com]
    Sent: Thursday, April 01, 2004 9:58 AM
    To: org
    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.
    Jayakumar Guest

  4. #4

    Default Re: Strings with extended characters

    --As of Thursday, April 1, 2004 9:58 AM -0500, com is
    alleged to have said:
     

    --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.
    ---------------------------------------------------------------
    Daniel Guest

  5. #5

    Default Re: Strings with extended characters

    com wrote: 

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


    John
    --
    use Perl;
    program
    fulfillment
    John Guest

Similar Threads

  1. Extended Characters are 'lost' on form submission
    By Tyran in forum Macromedia ColdFusion
    Replies: 5
    Last Post: July 7th, 08:08 AM
  2. Extended characters and HTML entities
    By Conti in forum Coldfusion Database Access
    Replies: 0
    Last Post: June 8th, 04:24 AM
  3. CFFILE and extended ASCII/accented characters
    By tomtedeschi in forum Coldfusion - Advanced Techniques
    Replies: 3
    Last Post: March 30th, 09:16 PM
  4. Extended characters in HTML files
    By RToonist in forum Macromedia Director Basics
    Replies: 2
    Last Post: February 23rd, 09:18 AM
  5. extended characters problem on ASP page
    By Ercan in forum ASP Database
    Replies: 1
    Last Post: September 25th, 07:18 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139