$req =~ s/\r//g ;
# This is replacing all carriage return special characters with nothing
globally.
# s/(replace)\r(carriage return special char)/(with nothing i.e delete
them)/g(globally. i.e for every match in the string, not just the first)/;

$req =~ s/([^\n]{72,72})\n([^\n]{1,71})\n([^\n]{1,71})$/$1\n$2$3/
# This regex appears to do nothing. It's looking for three matches, then
replacing them with the matches found. It's like saying look for all
instances of "one two three" in the string and replace them with "one two
three". Although I could be wildly wrong on that. ;)

For more on regexes:
http://www.google.com/search?sourceid=navclient&q=perl+regular+expressions

;)

HTH

John

-----Original Message-----
From: Lilian Alvarenga Caravela Godoy [mailto:[EMAIL PROTECTED]]
Sent: 21 February 2002 14:04
To: '[EMAIL PROTECTED]'
Subject: Regular Expression


Hi everyone

I am trying to learn Perl looking into some scripts.

One of them has a regular expression inside.

First of all, I need to know what two specific lines are doing. The code is
bellow.

$req =~ s/\r//g ;
$req =~ s/([^\n]{72,72})\n([^\n]{1,71})\n([^\n]{1,71})$/$1\n$2$3/

I know they are replacing some things but cannot understand what. Specially
the second one.

I would really appreciate if somebody could explain to me what that regular
expression means. It is kind of an emergency.

And, if someone knows a link where there is more information about regular
expressions, I would be grateful.

Thanks in advance.

Lilian



--------------------------Confidentiality--------------------------.
This E-mail is confidential.  It should not be read, copied, disclosed or
used by any person other than the intended recipient.  Unauthorised use,
disclosure or copying by whatever medium is strictly prohibited and may be
unlawful.  If you have received this E-mail in error please contact the
sender immediately and delete the E-mail from your system.



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to