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.
我不知道如何使用正则表达式,我已经看到它们用于电子邮件验证,有什么方法可以通过使用正则表达式来限制空值
/^(.+)$/
这个正则表达式将匹配任何不为空的东西(需要一个或多个字符),但是用正则表达式检查它真的有用吗?
答案是不。null 不是一个值。它表明您的指针不指向任何东西。您可以使用“断言”,或者只是 if(yourobject==null){}