Good catch. That's what I meant. :)
-----Original Message----- From: David Gray [mailto:[EMAIL PROTECTED]] Sent: Wednesday, April 24, 2002 8:51 AM To: 'Kevin Cornmell '; [EMAIL PROTECTED]; 'Timothy Johnson' Subject: RE: Patterm Matching > Actually, \n's are the one thing that the $ anchor doesn't > work exactly right on. Usually it's not a huge deal, but > Perl will still match a line that has a \n after the part > that you are trying to match if you use $ to anchor. This is > normally very useful, as in the case of a line of text being > read from a file. Without this behavior you would have to > put a \n at the end of all of your regexes. So: > > $radentry =~ /\n\n$/; > > will match "\n\n" and "\n\n\n" > > To fix this problem, you should remember the \Z anchor, which > matches only the end of a string. > > $radentry =~ /\n\n\Z/; >From perldoc perlre: \Z Match only at end of string, or before newline at the end \z Match only at end of string Should be: $radentry =~ /\n\n\z/; To match two newlines at the end of $radentry. -dave -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]