Created
October 20, 2015 19:43
-
-
Save buffpojken/de53b6b2810fc13cc95c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$string = "Dear students, | |
Mirjan sent a link to her Amazing presentation. So those of you who have are familiar with Evernote can revisit it here: | |
https://www.evernote.com/shard/s65/sh/e180fbf3-9c20-4fe5-85e2-939474e7ca1d/1f55bd659209cbd71fcf13ee83921140 | |
The rest shall have to wait patiently for me to turn it into a little less gigantic pdf. | |
Cheeerio!"; | |
$pattern = '/(http|https)\:\/\/[a-z0-9\-\.]+\.[a-z]{2,3}(\/\S*)?/im'; | |
$match = array(); | |
preg_match($pattern, $string, $match); | |
echo $match[0] . "\n"; | |
foreach($match as $m){ | |
// echo $m . "\n"; | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
$match[0] will be https://www.evernote.com/shard/s65/sh/e180fbf3-9c20-4fe5-85e2-939474e7ca1d/1f55bd659209cbd71fcf13ee83921140 on my php.
Regardless of linebreaks.