Created
February 19, 2019 15:41
-
-
Save Moc/9e1af2cd74487749015d4cc84b9ab708 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 | |
$string1 = '<link href="/css/bs4-dynamic-fields-form-2.min.css" rel="stylesheet" media="screen">'; | |
$string2 = '<script src="/cdn-cgi/apps/head/qx0HK83qWJ5I3r2xnETN-ETfo6s.js"></script>"'; | |
$regex1 = '~<link(.*?)href="([^"]+)"(.*?)>~'; | |
$regex2 = '/src=(["\'])(.*?)\1/'; | |
$result1 = preg_match($regex1, $string1, $matches1); | |
$result2 = preg_match($regex2, $string2, $matches2); | |
var_dump($matches1[2]); | |
var_dump($matches2[2]); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment