Categories
PHP

Remove MS Word formatting using PHP regular expressions

Recently i’ve had a client which would only paste into the CMS text from MS Word. Normally a JS should have been in place to automatically strip the crazy tags Word adds, but on this project this was not the case. Here’s hos to remove MS Word formatting using PHP regular expressions:

// it will remove all  comments
preg_replace('//i', '', $string);

or 

// it will remove all  comments
preg_replace('//i', '', $string);

1 reply on “Remove MS Word formatting using PHP regular expressions”

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.