gpt4 book ai didi

asp.net - 正则表达式排除双空格

转载 作者:行者123 更新时间:2023-12-05 09:00:17 30 4
gpt4 key购买 nike

我正在寻找适用于 c# asp.net 3.5 的正则表达式,如果句子或词组中有任何双空格,该正则表达式将失败。

the cat chased the dog = true
the cat chased the dog = false (doubles spaces occur at random intervals)

谢谢

最佳答案

尝试

^((?!\s{2}).)*$

在这个表达式中 (?!\s{2}). 匹配除空白字符外的每个字符,后跟另一个空白。

关于asp.net - 正则表达式排除双空格,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2667505/

30 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com