I'm trying to use the Regex - Parse tool to pull JAN-19 to FEB-19 from the following string:
Currency: USD Period: JAN-19 to FEB-19 Page: 1
I'm currently using this formula
Period:\s{2}(.+)\s{3,}
which is yielding this:
JAN-19 to FEB-19 Page:
I'm getting tripped up on what to add to get rid of the spaces and "Page:" Any ideas?
Solved! Go to Solution.
Hi @elamp6,
You could use the following expression in Regex parse mode:
Period:\s+([A-Z]{3}-\d{2}\s+to\s+[A-Z]{3}-\d{2})
If this solves your issue please mark the answer as correct, if not let me know! I've attached my workflow for you to download if needed.
Regards,
Jonathan
In RegEx, the * and + operators are 'greedy'. This means that they will include the maximum possible characters for which the expression can be true.
If you are a ? afterwards, it converts the operator so that it only takes the minimum characters for which it can be true.
Try:
\s{2}(.+?)\s{3,}
Hi @elamp6
Is your format always 3-character month followed by hyphen followed by 2 digit year?
If so, you can try this:
(\u{3}-\d{2}\s+to\s+\u{3}-\d{2})
This should just grab the 3 uppercase letters, hyphen 2 numbers, " to " (unsure of # spaces so used \s+), and another set of uppercase letters, hyphen, 2 numbers.
Let me know if that helps
Cheers!
Esther
That makes so much sense. Thank you! I used
Period:\s{2}(.+?)\s{3,}
and got exactly what I need.