开发者

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

开发者 https://www.devze.com 2023-03-23 18:01 出处:网络
We have a string: \"<b><c><d><e>\" And this Regexp: /<(\\w开发者_运维百科+)>/i

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

精彩评论

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