in reply to ActivePerl won't match carriage returns

You should show your actual code.

Did you read the whole file or just one line at a time? Perhaps you forgot to give the regex the multi-line option so that you can match across newlines?

  • Comment on Re: ActivePerl won't match carriage returns

Replies are listed 'Best First'.
Re^2: ActivePerl won't match carriage returns
by dsayars (Initiate) on Nov 01, 2011 at 22:44 UTC

    Thanks for the reply. I used the global /g. It's searching for certain code sequences in a huge XML file. Here are the actual matching statements:

    while ($text=~/IX='1'\/>([A-Z][A-Z][A-Z])(.*?)\r\n(.*?)\r\n|IX='0'\/>\r\n([A-Z][A-Z][A-Z])(.*?)\r\n(.*?)\r\n/g)              # doesn't work

    while ($text=~/IX='1'\/>([A-Z][A-Z][A-Z])(.*?)CRLF(.*?)CRLF|IX='0'\/>CRLF([A-Z][A-Z][A-Z])(.*?)CRLF(.*?)CRLF/g)     # works