Bonjour;
j'avais écrit cette regex :
Pour matcher un truc dans ce genre (dans un log)Code:m/((?:^\s*CARD\s+\d+\s+ALARM\s+STATUS.*$\n(?:^.*$\n){2})*)/m
Sur le site http://lumadis.be/regex/test_regex.phpCode:
1
2
3
4
5
6 CARD 1217 ALARM STATUS = No Alarms. DSM PORT A: ALARM STATUS = No Alarms. DSM PORT B: ALARM STATUS = No Alarms. CARD 1317 ALARM STATUS = No Alarms. DSM PORT A: ALARM STATUS = No Alarms. DSM PORT B: ALARM STATUS = No Alarms.
ça marche très bien, mais dans mon script Perl ça ne marche pas du tout.
J'ai donc écrit une autre regex :
Qui elle marche...Code:m/^((?:\s*CARD\s+\d+\s+ALARM\s+STATUS.*\n.*\n.*\n)+)/m
J'ai donc résolu mon problème... Mais sans comprendre pourquoi :calim2:
Si quelqu'un pouvait m'expliquer... J'ai horeur de programmer "au hazar"...
++Florent.