ksye1773 Posted July 31, 2008 Share Posted July 31, 2008 function HTMLSafeToUnicode(line, ishex) { var re = new RegExp('&#([0-9A-Fa-f]{2,4});'); var m = re.exec(line); while (m != null) { var re2 = new RegExp('&#'+m[1]+';','g'); line = line.replace(re2, String.fromCharCode(ishex==true?h2d(m[1]):m[1])); m = re.exec(line); } return line; } Link to comment https://forums.phpfreaks.com/topic/117516-converting-javascript-regexp-to-a-php-function/ Share on other sites More sharing options...
effigy Posted July 31, 2008 Share Posted July 31, 2008 html_entity_decode Link to comment https://forums.phpfreaks.com/topic/117516-converting-javascript-regexp-to-a-php-function/#findComment-604587 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.