0
votes

you can add comment in my project and you can reply my comment. I wanna the take name and surname after "@". How can i do ?

My find username function

const findUsername = message => {
var attachements = message.match(/@[^\s]+/g);
console.log(attachements);
return attachements !== null
  ? attachements.map(item => item).join('')
  : null;  };

this function just take the name, example: "@John Dao", function take the John. Anybody help me ?

Comment Example: Comment

Reply Example: Reply Example

Message argument example : "@Berkay Ergün skajjkdalskjdadsa"

message.match(/@(\S+)\s+(\S+)/);? - Wiktor Stribiżew
use message.split('@') - Mohit Sharma
Is the surname guaranteed? Is there ever a middle initial? What kind of content exists after the name? - MonkeyZeus
Please provide a sample string and point out what you wish to extract from it. - MonkeyZeus
Wiktor Stribiżew it two takes name and last name, Example: @John Dao@JohnDao - berkayer