PHP-Nasıl bir HTML belgesi arama ve php bazı dizeleri ayıklamak?

0 Cevap php

I have an html document that I saved as a .txt file. I want to extract each string following /user/ and make a comma-separated list of all the extracted strings. So every time there's a "/user/boy34" in this txt file, I would like to extract the "boy34" part. Im really new to PHP but I've been reading about the preg_match_all() function and I think that's what I need to use.

İşte ben bugüne kadar geldim ne var ama çalışmıyor:

<?php
$str = file_get_contents("comment.txt");
preg_match_all ('/^(user\/)\/[A-Z0-9][A-Z0-9_-]+\"$/i', $str, $preg);
print_r ($preg);
?>

Ben bu aldığım çıktı:

Array ( [0] => Array ( ) [1] => Array ( ) ) 

Biri bana yardım edebilir misiniz?

0 Cevap