How to remove inline css from data of body or any other field

Sometime there is a need to get original string data from some field or div or body. but when that data has generated through internal drupal script or data having Html code or style code.  it is necessary to  remove that  script, css or html code from the data.

Here is a code for removing inline style/css code from the data.

[code type=php]

$body = preg_replace(‘/style=\\”[^\\”]*\\”/’, ”, $body);