re = /Manufacturer:\s(?<Manufacturer>.*)/
str = '002446fffd003274.2:
Label: Back Door Lock
Manufacturer: Kwikset
Model: SMARTCODE_DEADBOLT_5
Firmware version: 0x3071cb06
Hardware version: 3
User Properties:
NearEndRssi: -41
NearEndLqi: 243
label: Back Door Lock
deadboltJammed: false
Battery Operated: True
Voltage: 5.8V
FE radio: -67/254
NE radio: -41/243
Date added: Thu Oct 27 08:02:42 CDT 2016
Date of last communication: Mon Feb 13 14:15:14 CST 2017
In Communication Failure: false
In firmware upgrade failure: false
Firmware upgrade available: false
Is Locked: true
Max Users: 30
Operation Mode: normal'
# Print the match result
str.scan(re) do |match|
puts match.to_s
end
Please keep in mind that these code samples are automatically generated and are not guaranteed to work. If you find any syntax errors, feel free to submit a bug report. For a full regex reference for Ruby, please visit: http://ruby-doc.org/core-2.2.0/Regexp.html