On Wed, Aug 08, 2001 at 02:24:39PM -0500, Mooney Christophe-CMOONEY1 wrote:
> > From: Sudarsan Raghavan [mailto:[EMAIL PROTECTED]]
> > Sent: Wednesday, August 08, 2001 1:48 PM
> > To: Sophia Corwell
> > Cc: [EMAIL PROTECTED]
> > Subject: Re: Deleting leading/trailing whitespace
> >
> >
> > ($temp) = $temp =~ m/^\s+(\S*)\s+$/;
>
> No, because this won't match the following string:
>
> $temp=" blah blah blah ";
>
> Because the blahs are separated by whitespace.
A better one-step regex would be something like this:
$temp =~ s/^\s+(.*\S)\s+$/\1/;
but that expects your string to contain at least one non-whitespace
character.
Z.
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]