Search code examples
regexposix

How to match all ASCII characters with POSIX regexp


Is there a way match all ASCII characters with POSIX extended regexp? [[:ascii:]] is not available in POSIX ERE.


Solution

  • You can compose a character class with [:print:] ([\x20-\x7E]) and [:cntrl:]
    ([\x00-\x1F\x7F]):

    [[:print:][:cntrl:]]