re = /^record(?<id>\d+),[0-9\#\$\%\-\+\,]+,(?<name>\w+),[\D\,]+,(?<PostalCode>\d+),[0-9\#\$\%\-\+\,]+,(?<Status>(true|false)),End$/mi
str = 'record18,$65535,sisoog,do,5463213,33436,12,18,-17,+16,78,trUe,End
record15,#15,25,45,sisoog,s,is,oog,5463213,6,-7,78,33-43,True,End
record16,55,-35,sisoog,End,use,wait,546365213,#88,15,5485,False,End
record17,15,-45,351,sisoog,do,wait,smit,5463213,33-436,faLse,End
record17,15,-45,351,sisoog,do,smit,5463213,3436,End'
# 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