« Back to Index

This is a nice concise where to extract the successful match within a capture group using Ruby: http://ruby-doc.org/core-2.2.0/String.html

View original Gist on GitHub

Tags: #method-i-5B-5D

ruby string regex.rb

"HTTP/123456 999"[/^HTTP\/[\d\.]+ ([\d]{3})/, 1] # => 999