简体   繁体   English

空白正则表达式

[英]Blank Regular Expression

Using Cforms and adding some validation in, thought i'd throw in the Honeypot method as well. 使用Cforms并添加一些验证,以为我也会抛出Honeypot方法。 With cforms it allows you to add a Regex into a field, but I have been trying to figure out how to create a "blank" regex. 使用cforms它允许您将正则Regex添加到字段中,但是我一直在尝试找出如何创建“空白”正则表达式的方法。

the best I have so far is to put a space into the field then use this regex: ^\\s This works perfectly well, but just out of pure interest, is there a pure blank version, so that if ANY character is typed in then it won't validate. 到目前为止,我最好的方法是在该字段中放置一个空格,然后使用此正则表达式: ^\\s这可以很好地工作,但是出于纯粹的兴趣,是否有一个纯空白版本,因此如果在其中键入任何字符,则它不会验证。

Thanks 谢谢

Like this? 像这样? ^$ (start+end with nothing in between). ^$ (开始+结束,中间没有任何内容)。

只是添加了另一种做相同事情的方式: .{0}

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

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