0
我正在擴展rouge
shell詞法分析器爲我的jekyll
網站,我想要做以下事情。匹配一個字符串,但只捕獲它的紅寶石匹配的子串
- 匹配
--word
。捕獲word
,丟棄--
。 - 比賽
<word>
。捕獲word
,丟棄<
和>
。 - 匹配
word=anyNumber.word
。捕獲word
和anyNumber.word
,丟棄=
。
首先,我已經試過/(?=-+)\w/
,沒有匹配,然後我試圖做反向並丟棄word
如/-+(?=\w*)/
,和它的工作。我做錯了什麼?
添加一個小例子和期望的結果將是有益的。如果你這樣做,一定要爲每個輸入值('str =「...」')分配一個變量,以便讀者可以引用變量而不必定義它們。 –