Regex to split on %[A..Za..z]

I am attempting to tokenize clock format strings from TCL in C# program using Regex.Split(). For example
%A %B %d %Y or %A_%B sometext %d_%Y

I tried a regex split on @"(%[a..zA..z]) but it seems to only match on the first found %A for example. So the result was %A '_%B sometext %d_%Y' (2 tokens)

I want to split that into %A _ %B sometext %d _ %y (7 tokens). The text in between the %X tokens can be output as a single token each including the whitespace.

I have tried @"(%[a..zA..z])|[^%.]+) as well but to no avail.

Additionally if the first letter after % is E or O, then match %Ex, for example, or %Ox where x is smaller set of chars (E: C,c,E,j,J,s,X,x,Y,y) (O: e,d,H,I,k,l,m,M,S,u,w,y)
Maybe @"(%E[CcEjJsXxYy])|(%O[edHIklmMSuwv])|(%[a..zA..z])|[^%.]+)

Any ideas?

Read more here: Source link