Method: String#extract

Defined in:
lib/core_ext/string.rb

#extract(pattern) ⇒ Object

Similar to scan, but remove matches from the string



96
97
98
# File 'lib/core_ext/string.rb', line 96

def extract(pattern)
  scan(pattern).tap { remove! pattern }
end