Skip to content

Instantly share code, notes, and snippets.

@sakuro
Last active March 23, 2024 07:43
Show Gist options
  • Save sakuro/204eca3dd3d8dca5387197db99a33cab to your computer and use it in GitHub Desktop.
Save sakuro/204eca3dd3d8dca5387197db99a33cab to your computer and use it in GitHub Desktop.

ASCII文字1のPOSIX正規表現クラス分類

クラス2 [:alnum:] [:alpha:] [:blank:] [:cntrl:] [:digit:] [:graph:] [:lower:] [:print:] [:punct:] [:space:] [:upper:] [:xdigit:] [:word:]
[00]-[08] [0e]-[1f] [DEL] - - - - - - - - - - - -
[HT] - - - - - - - - - -
[LF][VT][FF][CR] - - - - - - - - - - -
[SPACE] - - - - - - - - - -
記号3 - - - - - - - - - -
0-9 - - - - - - -
A-F - - - - - -
G-Z - - - - - - -
_ - - - - - - - - -
a-f - - - - - -
g-z - - - - - - -

Some formulae

  • [:ascii:] = [:ctrl:] + [:print:]
  • [:print:] = [:graph:] + " "
  • [:graph:] = [:alnum:] + [:punct:]
  • [:word:] = [:alnum:] + "_"
  • [:alnum:] = [:digit] + [:alpha:]
  • [:alpha:] = [:lower:] + [:upper:]

Footnotes

  1. [00]-[7f]

  2. Rubyによる拡張である [:ascii:] には [00]-[7f] の範囲の全ての文字がマッチ

  3. ! " # $ % & ' ( ) * + , - . / : ; < = > ? @ [ \ ] ^ ` { | } ~

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment