I can't figure this one out. I need to extract a sentence from a wall of text:
You are receiving this message because you have chosen to be notified of failures. The following have failed to post since the last e-mail you received:
Shipment Client Keys: 00000000000000012345, 0000000123, 1234567890123.
Post failed with a message: xxxxxxxxxxxxxxxx.
This message was sent with high importance
I need to extract just the "Shipment Client Keys" sentence. The issue is that the ID numbers that follow vary widely in length.
Any help is greatly appreciated!
Solved! Go to Solution.
@JohnO the following will take ‘Shipment Client Keys’ and then all of the numbers until it reaches the end of the sentence (full stop). Let us know if the requirement is different of course:
Using the RegEx tool in Parse mode:
(Shipment Client Keys:.+)\.
Apologies, that won’t actually work as it’ll continue to the end of the whole sentence, I was testing with a break line in place accidentally. Try the following instead:
(Shipment Client Keys:[\d\s,]+)\.
Thanks @DataNath! This is working.
Follow up question: Some of the emails have more than one "Shipment Client Keys" line. Is there a way to capture all of them?
@JohnO does the number of times this can appear vary, or is it always a sets amount (say once or twice)? The RegEx tool also has a tokenize option whereby it’ll pull out all instances of a pattern, as opposed to just the first occurrence like parse mode does. You can either split out to columns when tokenising, or rows (which is usually the best option if the number can vary).
Thanks, again @DataNath! Hopefully this is the last follow-up.
I have two types of entries that are failing:
Shipment Client Keys: 34716, 3PUSABQ01, 20220927.
and
Shipment Client Keys: 861767, A3Y1, 09/13/2022.
Any suggestions?
Ah sorry @JohnO, I thought the IDs and parts to be captured were just numbers! This should capture anything up until the first full stop:
(Shipment Client Keys:[^.]+)\.