我嘗試重用正則表達式組。重複使用正則表達式組
我有什麼:
Other Stuff
Other Stuff
Anker: 'Result1' 'Result2' 'Result3' 'Result4' 'ResultN'
Other Stuff
Other Stuff
我想要什麼:
$aVariable = [Result1, Result2, Result3, Result4, ResultN];
我曾嘗試:
Anker:(?: '(.*?)')+
(相信我,很多很多其他的正則表達式,但我不明白。)
在單行中獲取多個元素的正確方法是什麼?
在此先感謝!
哪個郎你正在運行? –
目前我正在運行這個正則表達式哥們,這是語言無關的。我在正則表達式中有所表達,而不是用特定語言實現 –
如果您使用的是C#,使用Captures集合非常容易。請將您的語言標籤添加到問題中。在這裏,試試RegexBuddy:['(?m)^ Anker:(?:\ s *('[^'] *'))+'](http://regexstorm.net/tester?p= %3FM)%5eAnker%3A(%3F%3A%5CS *(%27%圖5b%5E%27%圖5d *%27))%2b是I =其他+東西+%0D%0aOther +東西%0D%0aAnker%3A +% 27Result1%27 +%27Result2%27 +%27Result3%27 +%27Result4%27 +%27ResultN%27%0d%0aOther + Stuff%0d%0aOther + Stuff),(參見* RegexStorm.net *)。 –