(grep) Regex to match non-ASCII characters ?

(grep) Regex to match non-ASCII characters ?

Asked on December 27, 2018 in Regex.
Add Comment


  • 2 Answer(s)

    Below code will match a single non-ASCII character:

    [^\x00-\x7F]
    
    

    Refer this link for PCRE (Perl-Compatible Regular Expression).

    Use the POSIX shorthands:

    1. [[:ascii:]] -it will matches a single ASCII char.
    2. [^[:ascii:]] – it will matches a single non-ASCII char.

    [^[:print:]] it will satisfy our needs.

    Answered on December 27, 2018.
    Add Comment

    Try this link for : Unicode Regular Expressions:

    \p{Control}: an ASCII 0x00..0x1F or Latin-1 0x80..0x9F control character.
    
    Answered on December 27, 2018.
    Add Comment


  • Your Answer

    By posting your answer, you agree to the privacy policy and terms of service.