![](/img/trans.png)
[英]How can I grab the only part of a string that matches a regular expression?
[英]How can i use a regular expression in PHP that matches a given group in the whole string instead of stops at first match
我有以下表達式:
[\?&]([\w-]+)=([\w=.|()+%-]+)
我正在嘗試驗證以下查詢字符串:
?tn_cid=280&tn_fk_specifications_planten_planttype=Groene%20kamer+planten|hangplanten|tuinplanten&tn_fk_ae-waterbehoefte=Weinig%20(2x%20per%20maand)&tn_fk_specifications_planten_plantheight=30%20-%2035%20cm&tn_fk_ae-hoogte-plant=Kleine%20planten%20(tot%2040%20cm)&tn_fk_ae-prijs=16.99-16.99
但我的表達式只匹配字符串的第一部分,然后停止:
?tn_cid=280
如何讓表達式繼續匹配每個組(即?key=value 或 &key=value)直到完整字符串的結尾?
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.