如何从字符串中获取扫描和拆分结果 - 正匹配和负匹配?相当于
def scan_and_split(string, regexp)
string.split(regexp).zip(string.scan(regexp))
end
scan_and_split("{T}: Add {W} or {U} to your mana pool. Adarkar Wastes deals 1 damage to you.", /\{[^ ]+\}/)
预期输出:
[["", "{T}"], [": Add ", "{W}"], [" or ", "{U}"], [" to your mana pool. Adarkar Wastes deals 1 damage to you.", nil]]