> For the complete documentation index, see [llms.txt](https://wiki.smhuda.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://wiki.smhuda.com/programming/python/regex-remove-html-tags.md).

# Regex - Remove HTML Tags

| Character | Meaning                                                                                                                                   |
| --------- | ----------------------------------------------------------------------------------------------------------------------------------------- |
| <         | Matches character “<”                                                                                                                     |
| \[^<]     | Negated set - matches any character that is not in the set.                                                                               |
| +         | Matches one or more of the preceding token                                                                                                |
| ?         | If used immediately after any of the quantifiers \*, +, ?, or {}, makes the quantifier non-greedy (matching the minimum number of times). |

```
# Replace all html tags with blank from surveyAnswer column in dataframe df.
# regex=True is the default so you can choose not to explicitly specify it.
df["surveyAnswer"] = df["surveyAnswer"].str.replace('<[^<]+?>','',regex=True)
```
