Names for Example: note there is no spaces.
JohnJSmith
MikeLJohnson
PeterWWalker
result should be:
JohnSmith
MikeJohnson
PeterWalker
[A-Z]{2} RegEx matches only two cap letters, not sure how to proceed from here.
Thankyou.
Names for Example: note there is no spaces.
JohnJSmith
MikeLJohnson
PeterWWalker
result should be:
JohnSmith
MikeJohnson
PeterWalker
[A-Z]{2} RegEx matches only two cap letters, not sure how to proceed from here.
Thankyou.
Assuming,you have
1)Name starting with capital Letter followed by some small letters -> [A-Z][a-z]*
2)Capital Middle Letter-> [A-Z]
3)Capital Last Letter followed by some small letters -> [A-Z][a-z]*
U can split them into 3 groups
(^[A-Z][a-z]*)([A-Z])([A-Z][a-z]*)
Since you need first and last group.You can get like this -> $1$3
Eg.
'JohnJSmith'.replace(/(^[A-Z][a-z]*)([A-Z])([A-Z][a-z]*)/,'$1$3')->"JohnSmith"