gpt4 book ai didi

php - Zend_Validator_Regex 抛出错误 : Internal error while using the pattern

转载 作者:搜寻专家 更新时间:2023-10-31 21:40:44 25 4
gpt4 key购买 nike

Message: Internal error while using the pattern "(http://)?(www.)?(youtu)((be.com)|(.be))/.*"

$element = new Zend_Form_Element_Text($this->name);
$element->setRequired(true)
->setLabel(FileTypes::$names[$this->fileType])
->setDescription('Paste YouTube link here')
->setDecorators(FormDecorators::$simpleElementDecorators)
->addValidator('regex', false, '(http://)?(www\.)?(youtu)((be\.com)|(\.be))/.*');

即使使用简单的正则表达式也会抛出错误。

最佳答案

您是否已验证您的正则表达式是否正确?在正则表达式工具中尝试一下,看看它是否会产生任何错误。一个体面的工具应该告诉你为什么你的正则表达式是错误的,如果它是无效的。

我见过的大多数正则表达式通常都以某种字符结尾,通常是“/”。你的不是这个事实可能与你得到的错误有关。

您还应该记住,虽然 PHP 的正则表达式与 Perl 相似,但还是有一些不同之处。在这种情况下,它们可能无关紧要,但您仍然应该了解它们。 http://www.php.net/manual/en/reference.pcre.pattern.differences.php

关于php - Zend_Validator_Regex 抛出错误 : Internal error while using the pattern,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11465822/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com