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.
我正在尝试创建一个正则表达式语句来识别 9 个相同的重复数字。我认为 field like '0^9|1^9|2^9|3^9|4^9|5^9|6^9|7^9|8^9|9^9' 可行,但有更优雅的解决方案吗?
field like '0^9|1^9|2^9|3^9|4^9|5^9|6^9|7^9|8^9|9^9'
像这样的东西(对于标准 reg exp):
(\d)\1{8,}
\d将匹配任何数字(第一个),并且\1是对内部匹配项的向后引用,(...)并且{8,}需要向后引用 8 倍以上。
\d
\1
(...)
{8,}
编辑
我只是意识到这个问题与 ssms 有关,所以你可以使用这个:
{\d}\1^8