JupiterHost.Net wrote:
Gunnar Hjalmarsson wrote:
JupiterHost.Net wrote:
you likely need the multi line switch. change this:
my ($mso) = $row[2] =~ /(MS\d\d-\d\d\d)/i;
to:
my ($mso) = $row[2] =~ /(MS\d\d-\d\d\d)/si;
The /s makes it match through multi lines.
No, no, your understanding of the /s modifier appears to be a
misconception.
It changes '.' to match any character, even a newline, which
normally it would not match. Since there is no '.' in the above
regex, the /s modifier does not make a difference. See "perldoc
perlre".
I was referring to the part of perldoc perlre that says "s Treat
string as single line. ..."
Well, we all had reasons to assume that you were referring to this
particular case, right?
and then goes on to describe how that works in more detail.
The next sentence in "perldoc perlre" is crucial for the understanding
of the /s operator.
Unfortunately, the explanations of the /s operator in "perldoc
perlop", in connection with the descriptions of the m// and s///
operators, consist only of that first sentence. Those incomplete
explanations are probably causing this common misconception.
but since the string seemed to be a multiline string it might be
best to treat it as such just in case the regex is really only
grabbing data from the first line of the string for some reason.
That comment only confirms that you haven't understood. The above
regex does not contain any dots. Period.
Please do some testing, and don't give any further advise with respect
to the /s operator until you have gained a better understanding of
what it does.
--
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>