$text = 'Link to [Google](https://www.google.com/)'; echo preg_replace('/\[(.*?)\]\s*\(((?:http:\/\/|https:\/\/)(?:.+))\)/', '$1', $text); // Outputs: Link to Google