Repository navigation
trim extra spaces and new lines from get text? #2164
Unanswered
tincanfury
asked this question in
Q&A
Replies: 2 comments
|
Use RegEX Filter using regular expressions |
0 replies
|
You can do it inside the Get Text block itself. It has a Regex field, and if the regex matches, the match replaces the extracted text before it gets saved. Put this in the Regex field and leave the flags empty: It matches from the first non-whitespace character to the last one, so the leading newline/spaces and trailing spaces are dropped: Use a non-capturing group like above. The block does If you'd rather clean it later, a JavaScript Code block works too: const text = automaRefData('variables', 'myText'); // or automaRefData('table', '$last.myText') for a table column
automaSetVariable('myText', text.replace(/\s+/g, ' ').trim());
automaNextBlock();That one also collapses runs of spaces in the middle of the text. |
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
I have a Get Text that the field it's pulling text from has excess spaces and a newline:
Text I Want
Is there a way to trim/strip the excess spaces and newline?All reactions