且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何测试字符串是否包含特殊字符

更新时间:2022-11-22 13:25:35

在这种情况下我更喜欢preg_match()。你能告诉我们你想在名字中搜索什么样的特殊字符吗?


susen
I prefer preg_match() in such cases. Can u tell us what sort of special chars u like to search within names?

susen



请帮助亲爱的专家如何测试字符串,特别是在用户名中,例如,它包含特殊字符并返回无效!


请帮助... TIA
please help dear experts on how to test string especially in username for example wheter it contains special charater and will return invalid!

please help...TIA



一个简单的方法是使用strpos()函数。这是一个如何工作的简短教程

one simple way to do that is with the strpos() function. here is a short tutorial of how it works

展开 | 选择 | Wrap | / span> 行号



我更喜欢在这种情况下preg_match()。你可以告诉我们你喜欢在名字中搜索什么样的特殊字符吗?


susen
I prefer preg_match() in such cases. Can u tell us what sort of special chars u like to search within names?

susen



谢谢先生devsusen。 。:)但是我如何才能在preg_match()中添加字符,以便不仅仅找到1个特殊字符,例如仅由[]括起来的split函数。喜欢

thank you sir devsusen.. :) but how can i add characters to preg_match() in order to find not just 1 special characters like the split function that only enclosed by "[ ]" like

展开 | 选择 | Wrap | 行号