PHP Preg_match_all regexp模式
我需要你帮我做一个我自己做不到的模式 我得到了这个文件:PHP Preg_match_all regexp模式,php,regex,preg-match-all,Php,Regex,Preg Match All,我需要你帮我做一个我自己做不到的模式 我得到了这个文件: description1="SIOUH : Authentification Cerbere - Acces" description2="Acces formulaire authentification SIOUH" addheader="Pragma: no-cache " method="get" url="${AUTH_URL}/login/LoginDispatchAction.do?a
description1="SIOUH : Authentification Cerbere - Acces"
description2="Acces formulaire authentification SIOUH"
addheader="Pragma: no-cache "
method="get"
url="${AUTH_URL}/login/LoginDispatchAction.do?appId=${APP_ID}&backURL=${APP_URL_ENC}"
errormessage="Phase 1 : Impossible atteindre le formulaire authentification CERBERE pour SIOUH"
serveur="yes"
verifypositive="loginConnectAppliForm"
logrequest="yes" logresponse="no" />
我有这个preg_match_,所有这些都非常有效:
preg_match_all ( '#(.*?)="(.*?)"#s', $contents, $matches, PREG_SET_ORDER ); //Chaque option
我的问题是我可以用简单的引号而不是双引号,我如何改变我的模式来处理它?
例如,我需要像其他人一样抓住这条线:
parseresponse='name="conversationId" value="|"'
非常感谢您的帮助。尝试使用regex-liek
^(.*?)=[\'"](.*?)[\'"]$
使用反向引用要求结束报价与开始报价匹配:
'#(.*?)=([\'"])(.*?)\2#'
因为我可以在一行中使用[logrequest=“yes”logresponse=“yes”],所以我不能使用^i和$i nmy regexp。如果我使用[\'“]而不是我的”,我会得到以下结果:数组([0]=>parseresponse='name=“[1]=>parseresponse[2]=>name=),因为我的简单引号中有一个双引号(parseresponse是一种模式)第二组圆括号中使用贪婪的捕获-移除“#”(\w*?)=[“\'”](.*)[“\'”](.*)[“\'”]。“我在同一行上的[logrequest=“yes”logresponse=“yes”]遇到了问题完美!不知道这是可能的。我正在进行“#”(.*)=(?:(?:::“(.*”)(?)((?::)(?::)((.*))(?)::“(?))((?))::((?))#“但是你的更好,谢谢!