开发者

How to iterate through string for all regexp matches in Ruby?

We have a string: "<b><c><d><e>"

And this Regexp: /<(\w开发者_运维百科+)>/i

How can I get ALL of the matches from current string?


"<b><c><d><e>".scan(/<(\w+)>/)

See scan on ruby-docs

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜