我是初學者到PHP,我不知道如何解決此問題。獲取特定字符串,包括特定字符之間的特定字 - php
我有一個包含段落和鏈接的文本文件,這是從文本文件的例子:
$string = ("Lorem 'Ipsum' is simply: dummy 'http://www.exmplelink1.com/blah/blah/file 1 b.txt' text of the printing 'http://www.exmplelink1.com/blah/blah/file 1 c.txt' and typesetting industry. Lorem Ipsum 'http://www.exmplelink2.com/blah/file.txt' has been, the 'industry's standard'");
請注意,有很多單引號和二級域名的字符串:exmplelink1和exmplelink2
我怎麼只得到exmplelink1鏈接(單引號之間的完整鏈接)有兩個環節在這種情況下:
'http://www.exmplelink1.com/blah/blah/file 1 b.txt' 'http://www.exmplelink1.com/blah/blah/file 1 c.txt'
感謝您的幫助:)
的可能重複[找到所有的URL(鏈接)文本與PHP](http://stackoverflow.com/questions/6065362/find-all-urls-links-in-text-with-php) – Saty
使用正則表達式。像''http。*?''應該可以工作。 – fzzfzzfzz
我可能會添加,我真的不知道正則表達式:( – poxoson