re = /\* LIST \((?<Markers>.*)\) \"\/\" (?<folder>.*?)$/m
str = '* LIST (\\HasChildren) "/" INBOX/Arkabit
* LIST (\\HasNoChildren) "/" "INBOX/Arkabit/Flora (SAP)"
* LIST (\\HasNoChildren) "/" INBOX/BRW
* LIST (\\HasNoChildren) "/" INBOX/Chiptronics
* LIST (\\HasNoChildren) "/" INBOX/CRMB1.COM
* LIST (\\Marked \\HasChildren) "/" INBOX/CVA
* LIST (\\HasNoChildren) "/" INBOX/CVA/Contabilista
* LIST (\\HasNoChildren) "/" INBOX/CVA/Maxflex
* LIST (\\HasNoChildren) "/" INBOX/Decorlux
* LIST (\\HasNoChildren) "/" INBOX/Fabiano
* LIST (\\HasNoChildren) "/" INBOX/Fabielle
* LIST (\\HasNoChildren) "/" INBOX/Gamma
* LIST (\\HasNoChildren) "/" INBOX/Integrate
* LIST (\\HasNoChildren) "/" INBOX/Kelli
* LIST (\\HasNoChildren) "/" INBOX/Laborclin
* LIST (\\HasNoChildren) "/" INBOX/Macrosul
* LIST (\\HasChildren) "/" INBOX/MadeiraMadeira
* LIST (\\HasNoChildren) "/" INBOX/MadeiraMadeira/BRW
* LIST (\\HasNoChildren) "/" INBOX/MadeiraMadeira/Eglo
* LIST (\\HasNoChildren) "/" "INBOX/MadeiraMadeira/Full Fit"
* LIST (\\HasNoChildren) "/" "INBOX/MadeiraMadeira/Glass Mosaic"
* LIST (\\Marked \\HasNoChildren) "/" INBOX/MadeiraMadeira/Luciin
* LIST (\\HasNoChildren) "/" INBOX/MadeiraMadeira/Rojemac
* LIST (\\HasNoChildren) "/" "INBOX/Mercado do Alarme"
* LIST (\\Marked \\HasChildren) "/" INBOX/Stuff
* LIST (\\HasNoChildren) "/" INBOX/Stuff/Importado
* LIST (\\Marked \\HasNoChildren) "/" INBOX/Stuff/Ita&APo-
* LIST (\\Marked \\HasNoChildren) "/" INBOX/Stuff/Literal
* LIST (\\HasChildren) "/" INBOX/Stuff/News
* LIST (\\HasNoChildren) "/" INBOX/Stuff/News/Linkedin
* LIST (\\HasNoChildren) "/" INBOX/Stuff/News/Microsoft
* LIST (\\HasNoChildren) "/" INBOX/Stuff/News/SAP
* LIST (\\Marked \\HasNoChildren) "/" INBOX/Stuff/Postman
* LIST (\\HasChildren) "/" INBOX/Stuff/PrimaERP
* LIST (\\HasNoChildren) "/" INBOX/Stuff/PrimaERP/Faturas
* LIST (\\Marked \\HasNoChildren) "/" INBOX/Stuff/VSOnline
* LIST (\\HasNoChildren) "/" "INBOX/Suporte | CRMSAP"
* LIST (\\HasNoChildren) "/" INBOX/Umbler
$ OK LIST completed.
'
# 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