using System;
using System.Text.RegularExpressions;
public class Example
{
public static void Main()
{
string pattern = @"^La.+?no\s*(?'num_externe'.+?)\s.*\s(?:^.*\n)*.*installation\s*:\s*(?'ins_numins'.+?)\s+.*:\s*(?'apt_localisation'.+?)\s+.*:\s*(?'apt_nom'.+?)\s+.*:\s*(?'apt_email'.*?)\s+Typologie:.*\s*Motif.+?:\s*(?'qsy_lib'.+?)\s*Demande:\s*(?'commentaire_externe'.+)";
string input = @"Demandes - Date: 03/06/2019 à 09:58
La demande no 117530 a été externalisée à NORD ENGIE-Cofély,
Site concerné:
- Numéro d'installation : 2870521005
- Nom du Site : APE ST YRIEIX
Chargé d'affaire: Aurelie GUILLON
Email:
Typologie: Forfait heures multiservices
Motif détaillé: Demande
Demande: Objet : fixer la boîte à pharmacie petit format au mur. Bonjour, Je sollicite une intervention pour fixer la boîte à pharmacie petit format au mur en zone d'accueil à côté de l'extincteur. Cordialement. Sylvain CLUZEAU.
";
RegexOptions options = RegexOptions.Multiline;
foreach (Match m in Regex.Matches(input, pattern, options))
{
Console.WriteLine("'{0}' found at index {1}.", m.Value, m.Index);
}
}
}
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 C#, please visit: https://msdn.microsoft.com/en-us/library/system.text.regularexpressions.regex(v=vs.110).aspx