Skip to content

Instantly share code, notes, and snippets.

@buffpojken
Created October 20, 2015 19:43
Show Gist options
  • Save buffpojken/de53b6b2810fc13cc95c to your computer and use it in GitHub Desktop.
Save buffpojken/de53b6b2810fc13cc95c to your computer and use it in GitHub Desktop.
<?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";
}
?>
@buffpojken
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment