I have some data in this form:
@"Managers Alice, Bob, Charlie
Supervisors Don, Edward, Francis"
I need a flat output like this:
@"Managers Alice
Managers Bob
Managers Charlie
Supervisors Don
Supervisors Edward
Supervisors Francis"
The actual "job title" above could be any single word, there's no discrete list to work from.
Replacing the ,
with \r\n
is easy enough, as is the first replacement:
Replace (^|\r\n)(\S+\s)([^,\r\n]*),\s
With $1$2$3\r\n$2
But capturing the other names and applying the same prefix is what is eluding me today. Any suggestions?
I'm looking for a series of one or more RegEx.Replace()
calls only, without any LINQ or procedural code in C#, which would of course be trivial. The implementation is not directly in C# code, I'm configuring a generic parsing tool that uses a series of .NET regular expressions to transform incoming data from a variety of sources for several uses.