简体   繁体   English

正则表达式:3个数字超过4

[英]Regular Expression: 3 numbers over 4

How do you write a regular expression that has at least 3 over 4? 如何编写至少3个超过4个的正则表达式?

Example: 例:

28 -> false 28->错误

5555 -> true 5555->是

6498 -> true 6498->是

332 -> false 332-> false

234789 -> true 234789->是

Thank you! 谢谢!

^(?=(?:\d*[5-9]){3,})\d+$

You can use lookahead for this.See demo. 您可以为此使用lookahead 。请参见演示。

https://regex101.com/r/tD0dU9/5 https://regex101.com/r/tD0dU9/5

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM