How do I spilt the following string? I was thinking to use regex but can’t get my head around it.
Example 1
Part of: Asia Perspectives: History, Society, and Culture (15 Books) | by John Nathan | May 15, 2018
What I want is “John Nathan” and “May 15, 2018” in two separate strings.
Example 2
by Rebecca E. Karl | Aug 13, 2010
What I want is “Rebecca E. Karl” and “Aug 13, 2010” in two separate strings.
Use this below code @AnJoe_Ang
Split(Split(“History, Society, and Culture (15 Books) | by John Nathan | May 15, 2018”,“by”)(1).Trim,“|”)(0) - For “John Nathan”
Split(Split(“History, Society, and Culture (15 Books) | by John Nathan | May 15, 2018”,“by”)(1).Trim,“|”)(1) - For “May 15, 2018”
And
Split(Split(“by Rebecca E. Karl | Aug 13, 2010”,“by”)(1).Trim,“|”)(0) - For “Rebecca E. Karl”
Split(Split(“by Rebecca E. Karl | Aug 13, 2010”,“by”)(1).Trim,“|”)(1) - For “Aug 13, 2010”
Assuming every time at least “by (some name string) | (Date)” present at end of string
I think you can split string based on “|” and you will get some string array. Then you will have to get last 2 element from array. As there can be some times 2 or 3 element present in array based on above example. So getting last 2 will work here.