Regex group without capture

Is there a way to make a regex group without capturing the group (in
Perl I believe it’s possible, can’t find any docs how to do this in
Ruby)

From: S. Robert J. [mailto:[email protected]] :

Is there a way to make a regex group without capturing the group (in

Perl I believe it’s possible, can’t find any docs how to do this in

Ruby)

same, preprend “?:” , like (?:<expr_here>), where <expr_here> will not
be captured

irb(main):006:0> “this is a test”.scan /(this).(test)/
=> [[“this”, “test”]]
irb(main):007:0> “this is a test”.scan /(this).
(?:test)/
=> [[“this”]]
irb(main):008:0> “this is a test”.scan /(?:this).*(test)/
=> [[“test”]]

kind regards -botp