![](/img/trans.png)
[英]How do I write a regular expression that matches everything except a left and right parenthesis and anything between them
[英]How can I write a regular expression that matches everything between the first and the last quote?
我認為您不需要所有\\w
。 我也建議按照評論中的建議將任務分為兩部分。
但是,我也看到了一個選擇,只需一步即可 :
\[\[\[img(?:\s(\w+)="([^"]+)")?(?:\s(\w+)="([^"]+)")?(?:\s(\w+)="([^"]+)")?\]\]\]
這基本上是包裝器[[[]]]
,是正常字符部分img
,然后是(?:\\s(\\w+)="([^"]+)")?
重復出現的次數與您期望的屬性一樣。 (\\w+)
匹配屬性的名稱和([^"]+)
的值。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.