Reputation: 1123
How to scan for all string between *|
and |*
in text like
Today is *|date|*. Weather is *|weather_description|*.
using Ruby "string...".scan(...)
.
I would like to get array of matches: ["date", "weather_description"]
.
Upvotes: 2
Views: 560
Reputation: 16506
"Today is *|date|*. Weather is *|weather_description|*.".scan(/\*\|(.*?)\|\*/).flatten
# => ["date", "weather_description"]
Upvotes: 5