Remove periods from XML value

Post Reply
RunDontStop
Member
Posts: 51
Joined: Mon Apr 05, 2021 8:03 pm

Remove periods from XML value

Post by RunDontStop »

I feel like there is an easy way to do this that I cannot figure out. I am using XML Pickup element. In subsequent flow elements I access the desired Metadata value using Metadata:Text:Path.
I need a way to drop periods from the value as it is returned. Isn't there a way to use regular expressions to do this, in the Search field?
RunDontStop
Member
Posts: 51
Joined: Mon Apr 05, 2021 8:03 pm

Re: Remove periods from XML value

Post by RunDontStop »

I worked on this for a little while, and it looks like the Search option can grab text based on the period, and not include the period:
Search="[^.]{1,}"

This works, but not all the time. If the value was

Mechanical Engineering Inc.

It returns

Mechanical Engineering Inc

But, if it is

J.B. Publishing, Inc.

It returns

J

When what I really need is "JB Publishing Inc"

Apparently, this is "lazy" matching (finds the first period, then stops) but I need "greedy" matching (uses the whole string and finds all the periods). I couldn't find a way to get the greedy behavior.

I thought of injecting a dummy job. Renaming this dummy based on the XML value, with recursive search and replace of the periods with nothing. Assign a private data key=JobNameProper to this dummy job. Assemble it with the original input, with Merge Metadata enabled. At that point I am free to ungroup the job and discard the dummy file. The private data key from the dummy is preserved, which is the original XML value minus the periods.

The problem with this is I'm afraid it will get a little complicated, incorporating these dummy injects into all the flows and stages where I use this XML value. There might be a more sensible solution.
jan_suhr
Advanced member
Posts: 586
Joined: Fri Nov 04, 2011 1:12 pm
Location: Nyköping, Sweden

Re: Remove periods from XML value

Post by jan_suhr »

Try this app, I think it will fix this for you

https://www.enfocus.com/en/appstore/pro ... ng-replace
Jan Suhr
Color Consult AB
Sweden
=============
Check out my apps
RunDontStop
Member
Posts: 51
Joined: Mon Apr 05, 2021 8:03 pm

Re: Remove periods from XML value

Post by RunDontStop »

Thank you for this. As it turns out, I abandoned the dummy file idea. I thought of using Rename job to get a good text string, then follow it with another Rename job to restore the original file name. Then after doing that, I thought, why not just let the file keep the new name, no need to restore the original name. So to summarize, I use the XML value to create the new name, I use the Rename Job options to strip out the periods. Then a subsequent Private Data key=JobNameProper, and I have a good field, problem solved. But I did install the app you suggested and I'm sure I will use it at some point in time.
Post Reply