Regex to repeat a capture across a CDL?
Posted
by richardtallent
on Stack Overflow
See other posts from Stack Overflow
or by richardtallent
Published on 2010-05-26T15:52:12Z
Indexed on
2010/05/26
16:01 UTC
Read the original article
Hit count: 534
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?
© Stack Overflow or respective owner