note 129044 added to function.preg-match-all

From: Date: Wed, 15 Nov 2023 00:18:34 +0000
Subject: note 129044 added to function.preg-match-all
Groups: php.notes 
Request: Send a blank email to php-notes+get-221000@lists.php.net to get a copy of this message
EXAMPLE: $file = file_get_contents('file'); if(preg_match_all('#Task To Run(.*)#s', $file, $m)) { var_dump($m); } No output... preg_match_all not work if file exist BOM bytes (FF FE) : ╰─$ head -n1 file | hexdump -C 00000000 ff fe 48 00 6f 00 73 00 74 00 4e 00 61 00 6d 00 |..H.o.s.t.N.a.m.| clear BOM via dos2unix: ╰─$ dos2unix file dos2unix: converting UTF-16LE file file to UTF-8 Unix format... Check again: ╰─$ head -n1 file | hexdump -C 00000000 48 6f 73 74 4e 61 6d 65 3a 20 20 20 20 20 20 20 |HostName: | Great! Now preg_match_all works fine. ---- Server IP: 45.112.84.4 Probable Submitter: 45.91.157.134 (proxied: 159.224.63.118) ---- Manual Page -- https://php.net/manual/en/function.preg-match-all.php Edit -- https://main.php.net/note/edit/129044 Del: integrated -- https://main.php.net/note/delete/129044/integrated Del: useless -- https://main.php.net/note/delete/129044/useless Del: bad code -- https://main.php.net/note/delete/129044/bad+code Del: spam -- https://main.php.net/note/delete/129044/spam Del: non-english -- https://main.php.net/note/delete/129044/non-english Del: in docs -- https://main.php.net/note/delete/129044/in+docs Del: other reasons-- https://main.php.net/note/delete/129044 Reject -- https://main.php.net/note/reject/129044 Search -- https://main.php.net/manage/user-notes.php

« previous php.notes (#221000) next »