Reputation: 151126
Just to know more methods that can accomplish the same thing.
Upvotes: 2
Views: 333
Reputation: 80075
split( regex )
returns an array, leaving out all matches. Sometimes it's easier to specify what you don't want to see.
Upvotes: 1
Reputation: 370357
There are only two methods in the standard library which match a regular expression multiple times: gsub
(and gsub!
, of course) and scan
. gsub
returns a single string, so, yes, scan
is the only one the returns multiple results.
Upvotes: 0