Skip to content

Latest commit

 

History

History
14 lines (9 loc) · 205 Bytes

variables-from-a-regex.md

File metadata and controls

14 lines (9 loc) · 205 Bytes

Variables from a regex

if  /\A(?<first>\w+),\s*(?<last>\w+)\z/ =~ "Franze, Jr"
  puts "#{first} #{last}"
end

# Result:
# Franze Jr

View Source