re = /^(?:.*?\x7C){14}(?'champs1'.*?)\x7C(?:.*?\x7C){6}(?'champs2'.*?)\x7C(?'champs3'.*?)\x7C/m
str = '1906823505|BPA|CORENC-BPAUR0133|LR35788G|LEONETTI CATHERINE|04.76.88.14.14||INT|MG_ENS_010002|Ensemble Chauffage-Climatisation||MNT|MG116|05/06/2019 17:36:00|06/06/2019 10:36:00|4|FR|05/06/2019 16:36:00|BPA|CORENC-BPAUR0133|LR35788G|BPAURA-ENGIE LOIR|ENGIE COFELY LOIRE|0|||313|002|A1 - ESPACE 4|0|BP AUVERGNE RHONE ALPES (CORENC-BPAUR0133)|2 AVENUE DU GRESIVAUDAN||38700|CORENC|0438884619||||1906823505|merci d\'intervenir pour rétablir la clim à l\'agence'
# 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