Hi, I have a text string that looks something like this…
LOT 4-6 DP 287 SEC 2-3 SO 345152
I have a regex “(LOT \d+[\s?&-]\d+ DP \d+ ){1,}” that grabs the LOT 4-6 DP 287 from the text line.
How can I split the 4-6 into separate attributes so I end up with
Lot 4 DP 287
Lot 5 DP 287
Lot 6 DP 287
I could do it with a testfilter but there are unknown combinations. 1-12, 60-62, 78-82 etc
Any help is greatly appreciated.
Regards, Paul
Best answer by jkr_wrk
First use a StringSearcher to Regex Search the LOT_RANGE (second part of your LOT_CODE)
Then Split the LOT_RANGE on the minus to get the LOT_LIST containing 2 values
Then calculate the length of the LOT (RANGE_AMOUNT)=RANGE_LIST{1}-RANGE_LIST{0}+1
Then clone your features by RANGE_AMOUNT and store the RANGE_OFFSET (clone-index)
Then make the LOT_NUM=RANGE_LIST{0}+RANGE_OFFSET
And finaly you could StringReplace the LOT_RANGE in your string with the LOT_NUM. But don't know if you want to do it like that:
Result:
This post is closed to further activity.
It may be an old question, an answered question, an implemented idea, or a notification-only post.
Please check post dates before relying on any information in a question or answer.
For follow-up or related questions, please post a new question or idea.
If there is a genuine update to be made, please contact us and request that the post is reopened.
You @becchr beat me on time. Should have refreshed the page.
Almost exactly the same solution. My AttributeCreator_5 is integrated in your StringReplacer.
And my StringSearcher is only looking for Ranges after the word LOT.
I can imagine somewhere down the line you want every part of the LOT_CODE to be in separate columns. So you would split everything in the right column to start, but if this is the final result, this is a solution.