开发者

Matching a binary string with 3 or more occurrences of '1'. Can this regex be improved?

^[0-1]*1[0-1]*1开发者_如何学编程[0-1]*1[0-1]*$

To match a binary string with 3 or more occurrences of '1' This expression works...just trying to make it better.


To match three or more occurrences of 1, I would use:

^(0*1){3}[01]*$


i think it'll be something like this, edited changed with alans suggestions

^(0*1){3,}0*$
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜