I need to extract the middle and last names
Elev: 7EBB49 (Dan Greg Järgenstedt <[email protected]>)
Expected: Greg Järgenstedt
Elev: 6EBB49 (Dan Järgenstedt <[email protected]>)
Expected: Järgenstedt
Elev: 6EBB49 (Järgenstedt <[email protected]>)
Expected: Järgenstedt
Elev: 6EBB49 (<[email protected]>)
Expected:
Tried with
function getSNames(input) {
const names = input.match(/(?<!\[)(?<=\s)\w+(?=\s)/g);
return names ? names.join(' ') : '';
}
const names = input.match(/(?<!\(\p{L}+\s+|\p{L})\p{L}+(?:\s+\p{L}+)*(?=\s*<)/gu)- you are not using the latest pattern.