這是此問題的後續處理。 How to scan and return a set of words with specific characters in them in Ruby如何掃描其中包含特定字符的子字符串
我們希望掃描以某組字母開頭的單詞,然後將它們返回到數組中。事情是這樣的:
b="h ARCabc s and other ARC12".scan(/\w+ARC*\w+/)
,並取回:
["ARCabc","ARC12"]
我將如何做到這一點(我知道這是非常相似,我昨天什麼問)?
THX這麼多 - 很好的解釋 – timpone