Home › Forums › Back End › Identify a link from html using PHP regular expressions › Re: Identify a link from html using PHP regular expressions
The regular expression should be something like:
Try experimenting with the regex to get what you want (this would be a very helpful tool).
$mystring = ‘<p> Hello this is a WP post. <a href=”somefile.mp3″>Here is a link to mp3</a></p>’; preg_match(‘/^(([A-Za-z0-9-_]+).(mp3))+/’, $mystring, $matches); var_dump($matches); ?>