Regex to repeat a capture across a CDL?
- by richardtallent
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?