# Is it possible to remove an HTML attribute from the rich text?

**URL:** <https://forums.pega.com/t/is-it-possible-to-remove-an-html-attribute-from-the-rich-text/3063>\
**Category:** User Experience\
**Tags:** 8-6-3, user-experience\
**Created:** [August 9, 2022, 7:01pm UTC](https://forums.pega.com/t/is-it-possible-to-remove-an-html-attribute-from-the-rich-text/3063 "2022-08-09T19:01:01Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![AllanOliveira](https://yyz2.discourse-cdn.com/pega/user_avatar/forums.pega.com/allanoliveira/32/6969_2.png) [@AllanOliveira](https://forums.pega.com/u/AllanOliveira)\
**Post date:** [August 9, 2022, 7:01pm UTC](https://forums.pega.com/t/is-it-possible-to-remove-an-html-attribute-from-the-rich-text/3063/1 "2022-08-09T19:01:01Z")

</div>

For example, below html elements have “style” attribute. That shoudl be removed from the html code. likewise, any other attributes a html element might have.

- 

```auto
<span style="font-size:11pt"> <span style="line-height:115%"> <span style="font-family:Calibri. sans-serif"> <span style="font-size:12.0pt"> <span

style="line-height:115%"> Frequency of sampling and testing</span></span></span></span></span></li>

```

---

<div class="post-metadata">

**Author:** ![Lalit\_Singh1](https://avatars.discourse-cdn.com/v4/letter/l/a587f6/32.png) [@Lalit\_Singh1](https://forums.pega.com/u/Lalit_Singh1)\
**Post date:** [August 10, 2022, 2:36am UTC](https://forums.pega.com/t/is-it-possible-to-remove-an-html-attribute-from-the-rich-text/3063/2 "2022-08-10T02:36:52Z")

</div>

@AllanOlivera Yes, we can remove and we need to make sure in its not impacting the rich text.

---

<div class="post-metadata">

**Author:** ![AllanOliveira](https://yyz2.discourse-cdn.com/pega/user_avatar/forums.pega.com/allanoliveira/32/6969_2.png) [@AllanOliveira](https://forums.pega.com/u/AllanOliveira)\
**Post date:** [August 10, 2022, 12:30pm UTC](https://forums.pega.com/t/is-it-possible-to-remove-an-html-attribute-from-the-rich-text/3063/3 "2022-08-10T12:30:21Z")

</div>

@Lalit_Singh , What could the solution be?

---

<div class="post-metadata">

**Author:** ![AllanOliveira](https://yyz2.discourse-cdn.com/pega/user_avatar/forums.pega.com/allanoliveira/32/6969_2.png) [@AllanOliveira](https://forums.pega.com/u/AllanOliveira)\
**Post date:** [August 17, 2022, 6:49pm UTC](https://forums.pega.com/t/is-it-possible-to-remove-an-html-attribute-from-the-rich-text/3063/4 "2022-08-17T18:49:51Z")

</div>

```auto
I managed to remove the attributes by calling an activity containing a java step with the code below:

```

> ClipboardPage pg\_primaryPage=tools.getPrimaryPage();
> 
> TextInput = pg\_primaryPage.getString(propName);  
> {  
> TextOutput = TextInput.replaceAll(“(\<\w+)[^\>]\*(\>)”, “$1$2”);  
> }
> 
> pg\_primaryPage.getProperty(propName).setValue(TextOutput.toString());
