# Sanitizing user comment entries text field help

**URL:** <https://forum.inductiveautomation.com/t/sanitizing-user-comment-entries-text-field-help/57817>\
**Category:** Ignition\
**Created:** [March 30, 2022, 2:23pm UTC](https://forum.inductiveautomation.com/t/sanitizing-user-comment-entries-text-field-help/57817 "2022-03-30T14:23:18Z")\
**Posts on this page:** 1\
**Showing post:** 9

<div class="post-metadata">

**Author:** ![JordanCClark](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/jordancclark/32/83362_2.png) [@JordanCClark](https://forum.inductiveautomation.com/u/JordanCClark)\
**Post date:** [March 30, 2022, 2:58pm UTC](https://forum.inductiveautomation.com/t/sanitizing-user-comment-entries-text-field-help/57817/9 "2022-03-30T14:58:31Z")

</div>

If you can standardize on a single replace character, the regex becomes simpler.

```python
import re

Comments = self.parent.parent.getChild("topspacer flex_5").getChild("TextField_0").props.text

pattern = re.compile('[^a-zA-Z0-9 -]')

Comments = pattern.sub('', Comments)

```

---

_[View the full topic](https://forum.inductiveautomation.com/t/sanitizing-user-comment-entries-text-field-help/57817)._
