[eside-ghost] cojo expresion regular
txipi
txipi en sindominio.net
Mie Ago 25 14:47:08 CEST 2004
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Aupa Ender!
On Wed, 25 Aug 2004 14:43:16 +0200
txipi <txipi en sindominio.net> wrote:
> > O sea que si me viene un mail con estas cabeceras...
> > From: manuela_2525 en yahoo.es
> > X-Priority: 1
> > From: manuela_2525 en yahoo.es
> > X-Priority: 1
> > From: manuela_2525 en yahoo.es
> > X-Priority: 1
> > ...
w0ps... leyendo la Internet veo...
Matching across newlines
If you were to try these pattern substitutions on large blocks of text
that include multiple lines, you'd be in for confusion and
disappointment when a number of the matches didn't work. This is because
of the behaviour of the period metacharacter "." By default it matches
any character, except the newline character. Therefore the far-ranging
matching operation ".*" will only match up to the first newline
character encountered. But what if you need to match something that
starts on one line and spans several lines before it stops, like a long
HTML comment or table? The answer is to use the /s modifier, which
mnemonically means to "treat string as a single line". This changes the
behaviour of "." to match newline characters as well. For example:
$html = "<!-- Start of section -->
<p>Here is some content>
<!-- End of section -->";
In order to match the beginning of this comment to the end, we add the
/s modifier like this:
$html =~ s/<!-- Start.*End of section -->//s;
Without the /s, it wouldn't match at all.
- --
Agur
txipi
wget -O - http://sindominio.net/~txipi/txipi.gpg.asc | gpg --import
Key fingerprint = CCAF 9676 B049 997A 96D6 4D7C 3529 5545 4375 1BF4
The worst sin towards our fellow creatures is not to hate them,
but to be indifferent to them; that's the essence of inhumanity.
-- G.B. Shaw
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.5 (GNU/Linux)
iD8DBQFBLIpMNSlVRUN1G/QRAopvAJ4+dcMANQsMWvigV5jkWUOja+rsBQCfTYJu
Su9M03f1nolK5GxCyODLgwE=
=pU2U
-----END PGP SIGNATURE-----
Más información sobre la lista de distribución eside-ghost