re = /^(?'num_externe'\w+?)\t.*?\t.*?\t(?'ins_libl'\w+?)\t.*?\t.*?\t.*?\t(?'tsy_lib'\w+)\t(?'num_equipement'.+?)\t(?'commentaire_externe'.*?)\t(?'apt_localisation'.*?)\t.*?\t(?'apt_telephone'.*?)\t(?'apt_nom'.*?)\t/m
str = '472777 LECLERCQ 51402007 51402 77 7 03 BD BROSSOLETTE 02000 LAON PLO CHC En panne/ TRES URGENT : pas de chauffage : 16? dans le logement BROSSOLETT/ 77 7 BROSSOLETT/ 7 03/ VIROULAUD/ 0323234164 VIROULAUD Guy N?:500886 PT890/VIROULAUD/ BROSSOLETT 77 7 BD BROSSOLETTE'
# 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