# Re: Is there something like Regexp#match\_all

**URL:** <https://www.ruby-forum.com/t/re-is-there-something-like-regexp-match-all/79059>\
**Category:** Ruby\
**Created:** [December 11, 2006, 10:38pm UTC](https://www.ruby-forum.com/t/re-is-there-something-like-regexp-match-all/79059 "2006-12-11T22:38:05Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![phrogz](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/2acd7d/32.png) [@phrogz](https://www.ruby-forum.com/u/phrogz)\
**Post date:** [December 11, 2006, 10:38pm UTC](https://www.ruby-forum.com/t/re-is-there-something-like-regexp-match-all/79059/1 "2006-12-11T22:38:05Z")

</div>

From: Andi S.

> Sent: Monday, December 11, 2006 2:27 PM  
> To: ruby-talk ML  
> Subject: Is there something like Regexp#match\_all
> 
> is there a possibility to return all the matches of a regexp? or in  
> other words is there a way to apply a block to all matches at once?  
> Something like String#gsub but where I can specifiy what to  
> do with the  
> matches…

See String#scan. It and #gsub both accept a block.
