# Use replaceRE on multiple elements

**URL:** https://discourse.gohugo.io/t/use-replacere-on-multiple-elements/17857
**Category:** support
**Created:** [March 30, 2019, 7:25pm UTC](https://discourse.gohugo.io/t/use-replacere-on-multiple-elements/17857 "2019-03-30T19:25:18Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![Ken\_Button](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/ken_button/32/2331_2.png) [@Ken\_Button](https://discourse.gohugo.io/u/Ken_Button)
#### Post date: [March 30, 2019, 7:25pm UTC](https://discourse.gohugo.io/t/use-replacere-on-multiple-elements/17857/1 "2019-03-30T19:25:18Z")

</div>

How could you extend this to replaceRE also h1, h2, h3, etc…

---

<div class="post-metadata">

### Author: ![zwbetz](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/zwbetz/32/16088_2.png) [@zwbetz](https://discourse.gohugo.io/u/zwbetz)
#### Post date: [March 30, 2019, 10:08pm UTC](https://discourse.gohugo.io/t/use-replacere-on-multiple-elements/17857/2 "2019-03-30T22:08:34Z")

</div>

Hi. I split your post to a new topic since the previous one was already solved.

To answer your question, you could do something like (typed from phone so untested)

```
{{ $content := .Content | replaceRE "<p>" "<p class=\"mb4 px3\">" }}
{{ $content = $content | replaceRE "<h1>" "<h1 class=\"mb4 px3\">" }}
Etc. Etc.
{{ $content | safeHTML }}
```

---

<div class="post-metadata">

### Author: ![Ken\_Button](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/ken_button/32/2331_2.png) [@Ken\_Button](https://discourse.gohugo.io/u/Ken_Button)
#### Post date: [April 1, 2019, 2:02pm UTC](https://discourse.gohugo.io/t/use-replacere-on-multiple-elements/17857/3 "2019-04-01T14:02:42Z")

</div>

Thank You!!!
