Bug #71581 [Opn->Nab]: wrong behaviour when using "." in expression and newline in subject

From: Date: Sat, 13 Feb 2016 08:59:43 +0000
Subject: Bug #71581 [Opn->Nab]: wrong behaviour when using "." in expression and newline in subject
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-199186@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=71581&edit=1 ID: 71581 Updated by: requinix@php.net Reported by: kurt at kwnet dot at Summary: wrong behaviour when using "." in expression and newline in subject -Status: Open +Status: Not a bug Type: Bug Package: PCRE related Operating System: linux ubuntu (apache) PHP Version: Irrelevant Block user comment: N Private report: N New Comment: Thank you for taking the time to write to us, but this is not a bug. Please double-check the documentation available at http://www.php.net/manual/ and the instructions on how to report a bug at http://bugs.php.net/how-to-report.php http://php.net/manual/en/regexp.reference.dot.php It's the very first sentence on the page. Previous Comments: ------------------------------------------------------------------------ [2016-02-13 08:46:21] kurt at kwnet dot at Sorry, Description should be correct: Search for "." (any character)... ------------------------------------------------------------------------ [2016-02-13 08:45:07] kurt at kwnet dot at Description: ------------ Search for "," (any character) seems not to include linebreak. => wrong behaviour Test script: --------------- //search without newline: correct behaviour $subject="<tag>Hello World</tag>"; echo "[".preg_match('/<tag>[A-Za-z\\s]*<\\/tag>/',$subject)."]\n"; //[1] echo "[".preg_match('/<tag>[^<]*<\\/tag>/',$subject)."]\n"; //[1] echo "[".preg_match('/<tag>.*<\\/tag>/',$subject)."]\n"; //[1] //search with newline: different behaviour on using "." $subject="<tag>Hello\nWorld</tag>"; echo "[".preg_match('/<tag>[A-Za-z\\s]*<\\/tag>/',$subject)."]\n"; //[1] echo "[".preg_match('/<tag>[^<]*<\\/tag>/',$subject)."]\n"; //[1] echo "[".preg_match('/<tag>.*<\\/tag>/',$subject)."]\n"; //[0] WRONG RESULT ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=71581&edit=1

« previous php.bugs (#199186) next »