# Replace string in multiline text

**URL:** <https://forum.inductiveautomation.com/t/replace-string-in-multiline-text/34149>\
**Category:** Ignition\
**Created:** [April 23, 2020, 8:13am UTC](https://forum.inductiveautomation.com/t/replace-string-in-multiline-text/34149 "2020-04-23T08:13:10Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![SergioS](https://avatars.discourse-cdn.com/v4/letter/s/da6949/32.png) [@SergioS](https://forum.inductiveautomation.com/u/SergioS)\
**Post date:** [April 23, 2020, 8:13am UTC](https://forum.inductiveautomation.com/t/replace-string-in-multiline-text/34149/1 "2020-04-23T08:13:10Z")

</div>

Good morning I have problem when i go to use string.replace() in my script where string is a multiline text.

I don’t receive any error , script arrive to the end, but replace don’t be do it.

here a piece of code :

text = event.source.parent.getComponent(‘lblprintBase’).text

```
value = event.source.parent.getComponent('ptProd').QR
text.replace('@QR', value)

value = event.source.parent.getComponent('ptProd').Line1
text.replace("@LINE1", value)

value = event.source.parent.getComponent('ptProd').Line2
text.replace("@LINE2", value)

value = event.source.parent.getComponent('ptProd').Line3
text.replace("@LINE3", value)

value = event.source.parent.getComponent('ptProd').Line4
text.replace("@LINE4", value)

value = event.source.parent.getComponent('ptProd').Line5
text.replace("@LINE5", value)

event.source.parent.getComponent('lblprintMod').text= text

```

Some ideas ?

Thanks

---

<div class="post-metadata">

**Author:** ![Sanderd17](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/sanderd17/32/8735_2.png) [@Sanderd17](https://forum.inductiveautomation.com/u/Sanderd17)\
**Post date:** [April 23, 2020, 8:50am UTC](https://forum.inductiveautomation.com/t/replace-string-in-multiline-text/34149/2 "2020-04-23T08:50:04Z")

</div>

See some documentation: [Python String replace() Method](https://www.tutorialspoint.com/python/string_replace.htm)

> Python string method **replace()** returns a copy of the string...

So you need to reassign your text:

```auto
text = text.replace("@QR", value)

```
