I am trying to extract URL of Facebook / Twitter / Pinterest from shortcode which I put in my blog content using PHP's Regular Expression . The shortcode takes the following form like,
[embed type="facebook"]https://www.facebook.com/Techzoom.TV/posts/1960179340843049[/embed]
[embed type="Twitter"]https://twitter.com/HelloBdWorld/status/1568289461284524033[/embed]
I am not familiar with RegEx. But, I played with it a little and came with the pattern, like:
preg_match('/(\[embed\stype\=\"[facebook]+\"\]).*(\[\/embed\])/i', '[embed type="facebook"]https://www.facebook.com/Techzoom.TV/posts/1960179340843049[/embed]', $socialOccurrences);
The output that I get, is:
Array ( [0] => [embed type="facebook"]https://www.facebook.com/Techzoom.TV/posts/1960179340843049[/embed] [1] => [embed type="facebook"] [2] => [/embed] )
But, it's not giving me the URL (https://www.facebook.com/Techzoom.TV/posts/1960179340843049).
Can anyone help me solve the problem?