Our Community is getting an upgrade! To get everything ready for the relaunch, we’ll be placing the site in read-only mode starting September 21st.
We really appreciate your understanding while we get things set up behind the scenes. Catch up on all the exciting details about the move here.
Need help or have questions? Drop us a line at [email protected]
Created on
10-05-2019
10:56 AM
- last edited on
10-05-2019
01:37 PM
by
ask_bill_brooks
Hi,
I try to replace text with space using ReplaceTextWithMapping processor. I have file with multiple lines
"action":"account sing up"
"action":"account sign in"
"action":"account sign out"
And I have a mapping file with \t separating the search value and replace value
account sing up asu
account sign in asi
account sign out aso
Regular expressions "action":"(.*)"
Matching group: 1
Result
"action":"account sing up"
"action":"account sign in"
"action":"account sign out"
Expected:
"action":"asu"
"action":"asi"
"action":"aso"
Does anyone know what I did wrong?
Thanks
David
Created 10-09-2019 10:47 AM
Hello David,
The ReplaceTextWithMapping processor has been around for some time now and its design is rather simplistic in its current implementation. It is designed to match a simple regex that will map one group of non-whitespace characters to another group of characters (can have white space and back references).
in your example you are matching on a a set of characters that contains whitespaces.
If you were to add a replaceText processor to your flow to replace all the whitespace with a non-whitespace character like "-", then it will work. sample ReplaceText processor configuration:
Your mapping file would of course then be based off this change:
account-sing-up asu
account-sign-in asi
account-sign-out aso
the resulting mapping would then work:
Thank you,
Matt
Created 10-09-2019 10:47 AM
Hello David,
The ReplaceTextWithMapping processor has been around for some time now and its design is rather simplistic in its current implementation. It is designed to match a simple regex that will map one group of non-whitespace characters to another group of characters (can have white space and back references).
in your example you are matching on a a set of characters that contains whitespaces.
If you were to add a replaceText processor to your flow to replace all the whitespace with a non-whitespace character like "-", then it will work. sample ReplaceText processor configuration:
Your mapping file would of course then be based off this change:
account-sing-up asu
account-sign-in asi
account-sign-out aso
the resulting mapping would then work:
Thank you,
Matt
Created 10-09-2019 11:16 AM
Thank you. It really helps 😃