From 9b2dc55c30ebdd8fcf0707cf93ccb5a6cc8f7ccc Mon Sep 17 00:00:00 2001 From: Banana Date: Tue, 16 Jul 2019 15:35:04 +0200 Subject: [PATCH] extract emails from string --- single-functions/extract-email-links.php | 37 ++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 single-functions/extract-email-links.php diff --git a/single-functions/extract-email-links.php b/single-functions/extract-email-links.php new file mode 100644 index 0000000..feb7a34 --- /dev/null +++ b/single-functions/extract-email-links.php @@ -0,0 +1,37 @@ +]+|\(([^\s()<>]+|(\([^\s()<>]+\)))*\))+(?:\(([^\s()<>]+|(\([^\s()<>]+\)))*\)|[^\s`!()\[\]{};:\'".,<>?«»“”‘’]))#'; + + preg_match_all($urlpattern, $string, $matches); + if(isset($matches[0]) && !empty($matches[0])) { + foreach($matches[0] as $match) { + $ret[md5($match)] = $match; + } + } + + + return $ret; +} -- 2.39.5