Opposite of CHtml::encode()

I want to make a help system where topics are written in html. I want to include a search. But when I search the help text, the search can’t distinguish the normal text from html tags, css id’s classes, etc.

Is there an opposite of CHtml::encode() that returns the plain text from a html code? The result must be something like when I copy (formatted) text from browser and paste into notepad.

Eliminating the text between < and > with regular expression replace would be good enough?

There is a PHP function to remove tags: http://php.net/manual/en/function.strip-tags.php

You can use http://www.yiiframework.com/doc/api/1.1/CHtmlPurifier/

Chtml::decode() ? ??? I know it exist but I never tried.