in reply to Matching [^?-~]

The regular expression /[^?-~]/ matches a character that is not in the range "?" (ascii value 63) through "~" (ascii value 126). The character "&" is ascii value 38, outside the range. So the regex matches it. Note that "a", "s", "d", and "f" are all inside the range, so they are not matched.

-- Mike

--
just,my${.02}

Replies are listed 'Best First'.
Re: Re: [^?-~]
by Anonymous Monk on Aug 09, 2002 at 23:39 UTC
    Ooohhh, very cool. "-" isn't a character it's a range specifier. Now it makes sense. thanks.

      Inside a character class, '-' is a character only when it appears at the beginning (or right after the negation operator).

        Or at the end.


        Confession: It does an Immortal Body good.