--- code/trunk/pcre_dfa_exec.c 2007/03/02 13:10:43 96 +++ code/trunk/pcre_dfa_exec.c 2007/03/26 16:00:17 134 @@ -6,7 +6,7 @@ and semantics are as close as possible to those of the Perl 5 language. Written by Philip Hazel - Copyright (c) 1997-2006 University of Cambridge + Copyright (c) 1997-2007 University of Cambridge ----------------------------------------------------------------------------- Redistribution and use in source and binary forms, with or without @@ -2057,7 +2057,7 @@ Arguments: argument_re points to the compiled expression - extra_data points to extra data or is NULL (not currently used) + extra_data points to extra data or is NULL subject points to the subject string length length of subject string (may contain binary zeros) start_offset where to start in the subject string @@ -2163,8 +2163,8 @@ md->moptions = options; md->poptions = re->options; -/* Handle different types of newline. The two bits give four cases. If nothing -is set at run time, whatever was used at compile time applies. */ +/* Handle different types of newline. The three bits give eight cases. If +nothing is set at run time, whatever was used at compile time applies. */ switch ((((options & PCRE_NEWLINE_BITS) == 0)? re->options : options) & PCRE_NEWLINE_BITS) @@ -2308,6 +2308,15 @@ { while (current_subject <= end_subject && !WAS_NEWLINE(current_subject)) current_subject++; + + /* If we have just passed a CR and the newline option is ANY, and we + are now at a LF, advance the match position by one more character. */ + + if (current_subject[-1] == '\r' && + md->nltype == NLTYPE_ANY && + current_subject < end_subject && + *current_subject == '\n') + current_subject++; } }