Bonjour;
j'avais écrit cette regex :
	
	m/((?:^\s*CARD\s+\d+\s+ALARM\s+STATUS.*$\n(?:^.*$\n){2})*)/m
 Pour matcher un truc dans ce genre (dans un log)
	
	| 12
 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. | 
 Sur le site http://lumadis.be/regex/test_regex.php
ça marche très bien, mais dans mon script Perl ça ne marche pas du tout.
J'ai donc écrit une autre regex : 
	
	m/^((?:\s*CARD\s+\d+\s+ALARM\s+STATUS.*\n.*\n.*\n)+)/m
 Qui elle marche...
J'ai donc résolu mon problème... Mais sans comprendre pourquoi 
Si quelqu'un pouvait m'expliquer... J'ai horeur de programmer "au hazar"...
++Florent.
						
					
Partager