I'd like to use Regex.Split to split on a delimiter, and also have that delimiter split onto all substrings.
For Example:
I have a string "holidays/*/2024"
, and separator '*'
and I want to have following: "holidays/*","*/2024"
This thread shows how to split and keep the separators as their own elements of the result. I have also been able to use Lookbehind (?<=[*])
and Lookahead (?=[*])
separately, each achieving half of the desired result. I am struggling to see how to use both (or alternative solutions) to accomplish the desired result in a single expression.
Any suggestions?