in reply to regular Expression

Try
/[^!-~\s]/g

Replies are listed 'Best First'.
Re^2: Regular expression
by davorg (Chancellor) on Jun 29, 2005 at 11:18 UTC

    That doesn't really do what the original poster asked for tho' does it? Ascii characters are those with a character code between 0 and 128. Your code only checks for character codes between 33 and 126 (plus a few whitespace characters).

    To match _all_ non-ascii characters you really need something like:

    /[^\x00-\x7f]/
    --
    <http://www.dave.org.uk>

    "The first rule of Perl club is you do not talk about Perl club."
    -- Chip Salzenberg

Re^2: Regular expression
by Anonymous Monk on Jun 29, 2005 at 10:52 UTC
    Marvellous!It works Fine but pls explain me emav
      ^ = exclude
      !-~ = all characters between ! and ~
      \s = or spaces
      g = search globally

      As davorg has pointed out, mine is a rough regex but I use it often to find non-English characters in my xml files, as it not only works embedded in a perl script but also with editors that use perl-based regex's such as my favourite Unired.