Hi Guys, is there any way-out we can extract the Month and Year from a text string?
e.g.
Input: FROM :|January 1, 2022 to January 31, 2022
Output: January 2022
I have similar line strings for each month.
Thanks.
Solved! Go to Solution.
Hey @RajatRehria, when you say you have other lines that are similar, do you mean they're the same? If not it'd be great if you could provide a wider range of examples so we can figure out a solution that will fit. If they all follow the same format then this expression ought to do the trick:
DateTimeFormat(DateTimeParse([Input],'FROM :|%B %d, %Y'),'%B %Y')
Here is one method provided all of the strings start the same way and you only want the first Month/Year in the string. You can also use a Formula tool with RegExReplace.
RegEx Tool Replace Formula
(FROM :\|)(\w+)( \d+, )(\d{4})(.+)
Formula Tool Formula.
REGEX_Replace([Field1], '(FROM :\|)(\w+)( \d+, )(\d{4})(.+)', '$2 $4')