草庐IT

cricket_matches

全部标签

php - preg_match 获取文本

我有test.php和test1.php我有这个PHP代码正在运行我想做的是从test.php中获取文本从这个fid='gty5etrf'JavaScript我只需要fid的内容fid='gty5etrf';v_width=620;v_height=490;在test1.php中我只需要显示内容gty5etrf我必须做什么? 最佳答案 preg_match_all('/fid=\'([^\']+)\'/',$Text,$Match);你的正则表达式是错误的。首先,您正在寻找fid="..."而不是fid='...'。其次,使用.*,

php - 了解 preg_match 公式

我无论如何都让我的东西与以下行一起工作,但我真的无法理解。if(preg_match_all('/[^=]*=([^;@]*)/',shell_exec("/home/technoworld/Desktop/test/b'$test'"),$matches)){$x=(int)$matches[1][0];//optionallycasttoint$y=(int)$matches[1][1];$pcount=round((100*$x)/($x+$y),2);$ncount=round((100*$y)/($x+$y),2);}b是可执行文件,它给出的结果类似于x=10和y=20谁能给

php - preg_match 如何处理使用\Q..\E 时的定界符?

我在玩正则表达式,我尝试了\Q..\E转义序列。第一次尝试:$regex='/\Qhttp://\E/';var_dump(preg_match($regex,'http://'));它告诉我'\'是未知修饰符,完全可以理解。第二次尝试:$regex='/\Qhttp:\/\/\E/';var_dump(preg_match($regex,'http://'));var_dump(preg_match($regex,'http:\/\/'));它运行,不匹配第一个字符串,但匹配第二个。我知道我可以使用其他分隔符或不使用\Q..\E来解决它,但我很好奇它是如何工作的。我首先通过它通过分隔

php - preg_match 转储空数组

鉴于我有urlhttps://website.com/test/demo/success.php?token=-abc123-我想获取值abc123。不知何故,我在preg_match上得到了两个空字符串。$url='https://website.com/test/demo/success.php?token=-abc123-';preg_match('-(.*?)-',$url,$match);var_dump($match);输出:array(2){[0]=>string(0)""[1]=>string(0)""}我在这里做错了什么? 最佳答案

php - preg_match_all - 在字符串中查找完整 url 的正则表达式

我花了4个多小时试图找到我的php代码的正则表达式模式,但运气不佳。我有一个带有html代码的字符串。它有很多url格式,例如:example.comhttp://example.comhttp://www.example.comhttp://example.com/some.phphttp://example.com/some.php?var1=1http://example.com/some.php?var1=1&var2=2etc.我有以下部分工作的php代码:preg_match_all('/\b(?:(?:https?|ftp|file):\/\/|www\.|ftp\.)[

php - preg_match中的 `e`修饰符是什么意思?

我正在检查PHP代码是否存在可疑代码。我找到了preg_match('/^'.preg_quote($var1,'/').'/ie',$var2)但php不会发出任何警告,例如The/emodifierisdeprecated,usepreg_replace_callbackinsteadin或Unknownmodifier'e'in。测试:http://3v4l.org/6i8lne(PREG_REPLACE_EVAL)修饰符对preg_match有特殊意义还是被忽略? 最佳答案 嗯,在preg_match()中,修饰符e不会做任

php - 获取重音 preg_match_all 语法 PHP

我有这个preg_match_all来获取主题标签:preg_match_all('/(^|[^a-z0-9_])#([a-z0-9_]+)/ui',$text,$matchedHashtags);它工作得很好,但如果发现一些强调就会停止:#hash//works#hash_hash//works#hash_não//getjust$hash_n我需要改变什么? 最佳答案 您可以使用Unicodecategory信件。\p{L}匹配来自所有Unicodescripts的字母(≅语言)。正则表达式:/(?regex101Demo另一种

php - 为什么当我使用 simplexml_load_file() 时 preg_match() 结果在 PHP 中显示为 0?

我的php有一些问题,这是我的代码test.xml类似:Test655Tsungphp代码:asXML());$pattern="/结果显示为“0”,表示未找到,所以我更改$pattern值$pattern="document";结果显示“1”(表示找到)我调试了很多时间...也许编码UTF-8,ASCIIprobram或"/错了吗?我的目的是想解析这个字符串然后得到'..'有人可以告诉我我的错误在哪里吗??谢谢:)) 最佳答案 您正在使用解析器,只需解析它,不需要正则表达式。$xml='Test655Tsung';$xml=new

PHP preg_match 不适用于换行

这个问题在这里已经有了答案:PHPRegex:Howtomatch\rand\nwithoutusing[\r\n]?(7个答案)关闭去年。我有这个漂亮的preg_match正则表达式:if(preg_match("%^[A-Za-z0-9ążśźęćńółĄŻŚŹĘĆŃÓŁ\.\,\-\?\!\(\)\"\\/\t\/\n]{2,50}$%",stripslashes(trim($_POST['x']))){...}这应该允许可以在帖子中使用的所有字符以及帖子的最终文本内容。问题是,尽管\n它的功能仍然不适用于我帖子中的新行,因此语法为foobar不会工作。有谁知道为什么该功能无法正

php - 为什么PhpStorm会报 "Argument type does not match"错误?

我正在使用PhpStorm10.0.2开发一个PHP7项目。每当我为函数参数声明PHPDoc@param时,该参数具有标量类型的类型提示(string、int、...)我收到这个警告:Argumenttypedoesnotmatch这是PhpStorm提示的一些示例代码:classHostConfig{/***@varstring*/private$hostname;/***@varstring*/private$domainname;/***CreatesanewinstanceofhteHostConfigmodel.**@paramstring$hostnameAhostname