1. Find a binary number in a larger body of test
\b[01]+\b
2. Check whether a text string holds just a binary number
\A[01]+\Z
3. Find a binary number with a 0b prefix
\b0b[01]+\b
4. Find a binary number with a B suffix
\b[01]+B\b
5. Find a binary byte value or 8-bit number
\b[01]{8}\b
6. Find a binary word value of 16-bit number
\b[01]{16}\b
7. Find a string of bytes (i.e. a multiple of eight bits)
\b(?:[01]{8})+\b
Python 正则表达式验证二进制数字
最新推荐文章于 2022-06-12 00:29:19 发布