re = /^(?!.*;\[\w\w\].*).*/mi
str = 'Sendinput, {f1}+{Insert}
Sendinput, {f1}+{Pause}
Sendinput, {f1}+{Home}
Sendinput, {f1}+{PgUp}
Sendinput, {f1}+{PgDn}
Sendinput, {f2}{a} ;[2r] [3D Model Tre]
Sendinput, {f2}{b} ;[3b] [Accessibility Checker ]
Sendinput, {f2}{c} ;[2z] [Accessibility Report r]
Sendinput, {f2}{d} ;[5r] [Attachments]'
# 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