草庐IT

PREG_REPLACE_EVAL

全部标签

php - 如何将PHP的eregi改成preg_match

这个问题在这里已经有了答案:关闭9年前。PossibleDuplicate:HowcanIconverteregexpressionstopreginPHP?我需要帮助,下面是一个非常基本的小正则表达式,用于验证电子邮件,我确实意识到它不是最有效的,但对于我的需要来说,现在还可以。它目前使用PHP的eregi函数,php.net说它现在是一个贬值的函数,我应该使用preg_match来代替,简单地用preg_match替换erei是行不通的,可以有人告诉我如何让它工作吗?functionvalidate_email($email){if(!eregi("^[[:alnum:]][a-z

php - 如何将PHP的eregi改成preg_match

这个问题在这里已经有了答案:关闭9年前。PossibleDuplicate:HowcanIconverteregexpressionstopreginPHP?我需要帮助,下面是一个非常基本的小正则表达式,用于验证电子邮件,我确实意识到它不是最有效的,但对于我的需要来说,现在还可以。它目前使用PHP的eregi函数,php.net说它现在是一个贬值的函数,我应该使用preg_match来代替,简单地用preg_match替换erei是行不通的,可以有人告诉我如何让它工作吗?functionvalidate_email($email){if(!eregi("^[[:alnum:]][a-z

php - [a-z] 会匹配 PREG/PCRE 中的重音字符吗?

我已经知道PCRE(特别是PHP的实现)中的\w有时可以匹配一些非ASCII字符,具体取决于系统的区域设置,但是[a-z]呢??我不这么认为,但我在Drupal的核心文件之一(includes/theme.inc,已简化)中注意到这些行://Toavoidillegalcharactersintheclass,//we'reremovingeverythingdisallowed.Wearenotusing'a-z'asthatmightleave//incertaininternationalcharacters(e.g.Germanumlauts).$body_classes[]=

php - [a-z] 会匹配 PREG/PCRE 中的重音字符吗?

我已经知道PCRE(特别是PHP的实现)中的\w有时可以匹配一些非ASCII字符,具体取决于系统的区域设置,但是[a-z]呢??我不这么认为,但我在Drupal的核心文件之一(includes/theme.inc,已简化)中注意到这些行://Toavoidillegalcharactersintheclass,//we'reremovingeverythingdisallowed.Wearenotusing'a-z'asthatmightleave//incertaininternationalcharacters(e.g.Germanumlauts).$body_classes[]=

php - 警告 : preg_match(): Internal pcre_fullinfo()

我有以下工作代码:$test='123456';$int=preg_match('/^\d+$/',$test,$matches);print_r(array($int,$matches));但是,当我executeitoncodepad时,出现错误:Warning:preg_match():Internalpcre_fullinfo()error-3online5但是代码是在我自己的机器上运行的(恕我直言,代码应该没问题)。我需要在将来分发我的代码,所以如果它根据某些配置而中断,那就太糟糕了。那么键盘坏掉的原因是什么? 最佳答案

php - 警告 : preg_match(): Internal pcre_fullinfo()

我有以下工作代码:$test='123456';$int=preg_match('/^\d+$/',$test,$matches);print_r(array($int,$matches));但是,当我executeitoncodepad时,出现错误:Warning:preg_match():Internalpcre_fullinfo()error-3online5但是代码是在我自己的机器上运行的(恕我直言,代码应该没问题)。我需要在将来分发我的代码,所以如果它根据某些配置而中断,那就太糟糕了。那么键盘坏掉的原因是什么? 最佳答案

php - 在 PHP 中,哪个更快 : preg_split or explode?

在php中使用它提取搜索查询中的关键字时哪个更快:$keyword=preg_split('/[\s]+/',$_GET['search']);或$keyword=explode('',$_GET['search']); 最佳答案 Explodeisfaster,perPHP.netTipIfyoudon'tneedthepowerofregularexpressions,youcanchoosefaster(albeitsimpler)alternativeslikeexplode()orstr_split().

php - 在 PHP 中,哪个更快 : preg_split or explode?

在php中使用它提取搜索查询中的关键字时哪个更快:$keyword=preg_split('/[\s]+/',$_GET['search']);或$keyword=explode('',$_GET['search']); 最佳答案 Explodeisfaster,perPHP.netTipIfyoudon'tneedthepowerofregularexpressions,youcanchoosefaster(albeitsimpler)alternativeslikeexplode()orstr_split().

php - preg_replace 在引号后大写字母

我有这样的名字:$str='JAMES"JIMMY"SMITH'我运行strtolower,然后运行​​ucwords,它会返回:$proper_str='James"jimmy"Smith'我想将第一个字母是双引号的单词的第二个字母大写。这是正则表达式。看来strtoupper不起作用-正则表达式只是返回未更改的原始表达式。$proper_str=preg_replace('/"([a-z])/',strtoupper('$1'),$proper_str);有什么线索吗?谢谢!! 最佳答案 最好的方法可能是使用preg_repla

php - preg_replace 在引号后大写字母

我有这样的名字:$str='JAMES"JIMMY"SMITH'我运行strtolower,然后运行​​ucwords,它会返回:$proper_str='James"jimmy"Smith'我想将第一个字母是双引号的单词的第二个字母大写。这是正则表达式。看来strtoupper不起作用-正则表达式只是返回未更改的原始表达式。$proper_str=preg_replace('/"([a-z])/',strtoupper('$1'),$proper_str);有什么线索吗?谢谢!! 最佳答案 最好的方法可能是使用preg_repla