Path: csiph.com!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail From: Arno Welzel Newsgroups: comp.lang.php Subject: Re: preg_match() return false Date: Mon, 28 Dec 2020 15:16:57 +0100 Lines: 59 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-15 Content-Transfer-Encoding: 8bit X-Trace: individual.net 5EBxzXQpi1BAd8yEnFnKNQjbXgqfk0ROEgxZP95G8T7sisTuPu Cancel-Lock: sha1:kvVkI0q5IlwZJlRlGEAnjTMuSAE= In-Reply-To: Xref: csiph.com comp.lang.php:18487 alex: > Il 27/12/20 14:43, Arno Welzel ha scritto: >> alex: >> >>> $regex = file_get_contents( >>> // Download URç: https://files.fm/f/9mwzkn2wr >>> 'data/regex' >>> ); >>> $subject = file_get_contents( >>> // Download URL: https://files.fm/f/8xeaybz5z >>> 'data/subject' >>> ); >>> >>> $matching = preg_match($regex, $subject); >>> >>> if (0 === $matching) { >>> echo "Matching is 0"; >>> } elseif (FALSE === $matching) { >>> echo "Matching is FALSE"; >>> } else { >>> echo "OK!!!"; >>> } >>> >>> Output: >>> >>> Matching is FALSE >> >> What is the content of data/regex and data/subject? The URLs you >> mentioned? Why do you think that >> >> https://files.fm/f/9mwzkn2wr >> >> and >> >> https://files.fm/f/8xeaybz5z >> >> Will match? >> >> > > Instead of the content of the files I have published only the url, in > order to download and consult them more comfortably. > But I see you didn't like this solution. > > So I show them directly: > > $ cat data/regex > #Mock message .+¶ > .+¶ > .+ > \-\-\-\-\- This is not a valid regular expression. -- Arno Welzel https://arnowelzel.de