First of all, thank you very much for answer my question, I appreciate it very much
yes I do believe I have did my homework (even if I have not always
understood what I have readen so far) and yes seen there is not
'perfect' solution to achieve my goal, that is exactly one of the main
reason that leaded me to post here : asking the experts.
you mean by "what you have used to define a URL", I'm sorry but
english is not my mother tongue. I actually have a text file full of
urls, in different format (either link, or plain text, some have
http/https some only www), those urls are in a middle of text that I'm
not wishing to use (let say that I concider it has junk) and I wish to
extract all those url, my goal is to put them into an array to then be
able to feed one field of my database. if that is not what you meant by
"define the url" please let me know and I would be more than please to
try to be more clear.
to achieve my goal I first I load all the content of thise file in a variable doing $string = file_get_contents('mytext.txt');
As you have advised me, I have tried
$pattern = '(https?://)?\w+(\.\w+)+';
$titi = preg_match_all($pattern,$string,$out);
but this return me an error, as follow
Warning: preg_match_all() [function.preg-match-all]: Unknown modifier '?' in L:\localhost\www\scripts_utiles\extract_urls\extract_urls.php on line 87
what do I do wrong?
Thank you very much for your help and please forgive my ignorance, I'm all hear to learn more
ps: you are correct I don't need the parameters in the url, actually I just need the domaine name and the tld