[TxMt] Simple Command to strip HTML tags

Mats Persson mats at imediatec.co.uk
Sat Feb 19 13:22:55 UTC 2005

On 18 Feb 2005, at 20:00, saul rosenbaum wrote:
> anyone have a command to strip HTML markup?
> for selected text?

if you have PHP installed then you can just use the following command:

php -r 'echo strip_tags( $_ENV["TM_SELECTED_TEXT"] );'

if you want to keep all <p> tags, then you would just create a copy of 
the command with

php -r 'echo strip_tags( $_ENV["TM_SELECTED_TEXT"], "<p>" );'

and so on, more info on the PHP site.

Don't have PHP, well there's an easy 1 minute install option at 

Kind regards,


"TextMate, coding with an incredible sense of joy and ease"
- www.macromates.com -

More information about the textmate mailing list