Multiline text input - find/replace line breaks

20 views
Skip to first unread message

neilki...@gmail.com

unread,
Jun 15, 2026, 11:43:28 AM (3 days ago) Jun 15
to XMPie Interest Group
Hi all

A user will be entering text into a multiline text input dial. We'd like the same information to appear elsewhere in the document but without line breaks. We've tried FindandReplace with both \r and \n without success. What are we missing?

Thanks
Neil

west-digital.fr

unread,
Jun 16, 2026, 8:17:04 AM (2 days ago) Jun 16
to XMPie Interest Group
Hello,
Honestly, I expected \n to work.
What is your QLingo code exactly?

neilki...@gmail.com

unread,
Jun 16, 2026, 9:53:03 AM (2 days ago) Jun 16
to XMPie Interest Group
In an ADOR, Trim(Findandreplace(@{School}, "\n", " "))
The variable is the dial.

couch

unread,
Jun 16, 2026, 9:20:42 PM (2 days ago) Jun 16
to XMPie Interest Group
i created a small test document using your logic and it worked fine with multi-line text. The logic correctly removes the newline and adds the space.

It sounds like you might be using rich text? 

When using rich text, XML tags are sent in the value from uStore to the plan file. so, you need to match more than just the new lines.

This regex version works in a quick test: 
FindAndReplace(FindAndReplaceByRegExp(@{text}, "</?[^>]+>\r?\n?|\t+| {2,}", "", false), "\n", " ")

It is designed to remove:
* any html/xml tags from the value including any newlines added after the tags
* any tabs (since the xml is nicely structured with tab indents)
* and any instances of two or more spaces together. (this is possibly not needed and was added when I thought the structuring was with spaces, but it turned out to be tabs)

It then uses your regular findAndReplace to change newlines to spaces.

Reply all
Reply to author
Forward
0 new messages