in reply to Re: Re: How do I determine if a string contains non ascii characters
in thread How do I determine if a string contains non ascii characters

There is a POSIX macro for this: [:ascii:]. That is NOT a character class in and of itself -- it must be used IN a character class:
if ($string =~ /[^[:ascii:]]/) { # a non-ASCII character was found! }


japhy -- Perl and Regex Hacker
  • Comment on Re: Re: Re: How do I determine if a string contains non ascii characters
  • Download Code

Replies are listed 'Best First'.
Re4: How do I determine if a string contains non ascii characters
by Hofmator (Curate) on Jul 13, 2001 at 19:40 UTC

    Or use the negated POSIX (perlish addition) 'character class' directly: if ($string =~ /[[:^ascii:]]//) {

    -- Hofmator