> Message du 30/09/08 17:37
> De : "Matthias Leopold"
> A : beginners@perl.org
> Copie à :
> Objet : regex and newline
>
>
> hi,
>
> can someone please explain to me how to match patterns that contain
> newlines?
>
> when file.txt contains
>
> aaa
> bbb
> ccc
> ddd
> eee
>
> why doesn't
>
> perl -pe 's/bbb.*?ddd//s;' file.txt
>
> remove lines 2-4?


need a 's' modifier. from 'perldoc perlre':

[Modifiers]
s     Treat string as single line.  That is, change "." to match any character 
whatsoever, even a newline, which normally it would not match.
 Used together, as /ms, they let the "." match any character whatsoever, while 
still allowing "^" and "$" to match, respectively, just after and just before 
newlines within the string.



Regards,
Jeff.

 Créez votre adresse électronique [EMAIL PROTECTED] 
 1 Go d'espace de stockage, anti-spam et anti-virus intégrés.

Reply via email to