pepebe
7/12/2012 - 8:40 AM

OpenOffice: Strip HTML Tags from your OpenOffice Document using Regular Expressions

OpenOffice: Strip HTML Tags from your OpenOffice Document using Regular Expressions

Source: http://www.zyxware.com/articles/643/strip-html-tags-from-your-openoffice-document-using-regular-expressions
By webmaster on September 7, 2009 - 22:18HTML1

Openoffice comes with a stripped down version of regular expression for both of its Find/Replace Utility as well as its Calc Formulae. It however still packs a punch for most common operations. Here is how you can strip HTML tags from an open office document using the Find/Replace dialog.
Open the Find/Replace dialog.
Click on the more options button and enable the regular expressions checkbox
Enter 
```
<([:alpha:]+)[^>]*>([^<]*)</(\1)>
``` 
in the find box

Enter 
```
$2
``` 
in the replace dialog.

Press Find and Replace All until all tags are stripped out.
This method will not work if the HTML is not well formatted and it will not take out self closing tags. 

Properly self-closed tags can be replaced by using the pattern 
```
<[:alpha:]+[^>/]*/> 
```
in the find text box and an empty string in the replace box.
For everything else you will have to devise your own custom expressions :-)