【问题标题】:php ereg deprecation [duplicate]php ereg弃用[重复]
【发布时间】:2011-12-05 20:47:38
【问题描述】:

可能重复:
Converting ereg expressions to preg

我尝试过转换,但一直失败。

我的ereg:if (!ereg("^[a-zA-Z0-9]{3,16}$",$username)) {

是错误的,因为它已过时。如何切换到preg_match

【问题讨论】:

标签: php regex


【解决方案1】:
if (!preg_match("/^[a-zA-Z0-9]{3,16}$/",$username)) { /* .. */ }

注意分隔符/

【讨论】:

  • 谢谢。我明白我做错了什么。
猜你喜欢
  • 2012-04-14
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2011-09-23
  • 2014-04-29
  • 2011-05-12
  • 1970-01-01
  • 2010-11-24
相关资源
最近更新 更多