Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
正規表現の初心者: 長さ 5 の英数字文字列の正規表現が欲しかった
大文字または数字のみを含めることができる場合
有効な文字列 FCKGW A32FD 1CF2Gなど
編集して使用するソリューションを追加: re.match(r'[A-Z0-9]{5}',str)
次の文字のみを許可する有効な正規表現: AZ (大文字) および 0-9 は、次のようになります。
^[A-Z0-9]{5}$
小文字も許可する場合、正規表現は次のようになります。
^[A-Za-z0-9]{5}$