I have a list of names where the last and first names appear together:
BorisovaSvetlana A.; KimHak Joong; PuXiaotao; LiuHung-wen*
I would like to add a comma and space between last and first names, for the output to be:
Borisova, Svetlana A.; Kim, Hak Joong; Pu, Xiaotao; Liu, Hung-wen*
I am using a String Manipulation node in KNIME and I think regexReplace($col1$, ,"")
would be used and perhaps some kind of lookahead using [a-z] and [A-Z] to look for instances of a lowercase directly letter followed a capital letter, but I am new to regex so that's all I have so far.
How do I solve this problem?
This RegEx might help you to design a proper expression to match all your inputs:
([A-Z]{1}[a-z-]{1,})([A-Z]{1}[a-z-]{1,})
a-z
to \w
.$1$2
with $1, $2
.It means that,
Based on Pushpesh's advice, it can be much simplified to this expression:
([A-Z][a-z-]+)([A-Z][a-z-]+)