axiom82 Posted December 24, 2009 Share Posted December 24, 2009 I'm trying to replace the Microsoft Office Link Code found in the source code of Word docs. You may have seen this before: $msword_text = ' HYPERLINK "http://www.website.com" http://www.website.com'; Here is what I'd like to see: <a href="http://www.website.com">http://www.website.com</a> Here is what I've tried: $msword_text = preg_replace('/ HYPERLINK "(.+)" (.+)/', '<a href="\\1">\\2</a>', $msword_text); It doesn't work and I've been banging my head on this one for hours. Please help! Link to comment https://forums.phpfreaks.com/topic/186230-preg_replace-on-multiple-matches/ Share on other sites More sharing options...
JAY6390 Posted December 24, 2009 Share Posted December 24, 2009 $result = preg_replace('/ HYPERLINK "(.+?)" (.+?)/s', '<a href="\1">\2</a>', $subject); Link to comment https://forums.phpfreaks.com/topic/186230-preg_replace-on-multiple-matches/#findComment-983584 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.