我需要一个正则表达式来检查给定的二进制数(转换为十进制时)是否为2的幂。
答案 0 :(得分:2)
如果二进制数是2的幂,则其最左边的位必须为git checkout dev
git branch -f master
,其后的所有其他位(如果有)必须为 author title Time
0 ABC News WATCH: How to get the most ... 1
1 ABC News WATCH: Man who confessed ... 1
2 ABC News WATCH: Nearly 1,000 still ... 1
3 ABC News WATCH: Teen hockey player ... 1
4 ABC News WATCH: Trump: Will not do ... 1
5 Ali Dukakis Mueller and Trump 'has no eff... 1
6 Elizabeth McLaughlin US military troops to be ... 1
。
因此,此正则表达式将完成这项工作:
1
如果数字可以有前导零,也可以在开头使用0
来匹配它们:
^10*$