I need to parse the email header (from, to) from gmail api and separate it example: "John Doe " become name: "John Doe" and email: "john.doe@gmail.com". I already found the solution, however it is in javascript. I need to convert it to java code. I have problem in change javascript regex to java:
const regex = /(([\w,\"\s]+)\s)?<?([^@<\s]+@[^@\s>]+)>?,/g;
This is my regex in java:
String regex = "(([\\w,\\"\\s]+)\\s)?<?([^@<\\s]+@[^@\\s>]+)>?";
I try to remove the first '/' and ',/g' character and also replace all '\' with '\\' character but still get error in regex.
This is not a duplicate of Print Hello Question because the problem is with matching the characters in the regex and not printing them. I already know about "\"" make " in java.