如何扫描之间的所有字符串*|和|*文本一样
Today is *|date|*. Weather is *|weather_description|*.
Run Code Online (Sandbox Code Playgroud)
使用Ruby "string...".scan(...).
我想获得一系列的比赛:["date", "weather_description"].
"Today is *|date|*. Weather is *|weather_description|*.".scan(/\*\|(.*?)\|\*/).flatten
# => ["date", "weather_description"]
Run Code Online (Sandbox Code Playgroud)