Javascript regex pattern to java 8 regex pattern.
Above comment I think he forget to mention some point when we convert such complex Javascript based regex pattern.
For example below regex basically for email validate.
^(([^<>#&%/?~()[].,;:|\s@"]+(.[^<>#&%/?~()[].,;:|\s@"]+)*)|(".+"))@((<>#&%/?~()[].,;:|\s@"]+.)+<>#&%/?~()[].,;:|\s@"]+)$
Go to https://regex101.com
Insert your regex.
Then select Java 8 refer below screenshot.
You can see in below screenshot there is some error showing in right hand side just fix that error and copy the same script and it will work same as in JS.

I fixed that error which was showing please refer below screenshot. It will give true if user have given invalid mail address.

Adding below code snap which help you to test string cases
import java.util.regex.Pattern;
public class Test {
public static void main(String[] args) {
String testEmailAddress = "[email protected]";
Pattern _PATTERN = Pattern.compile("^(([^<>#&%/?~()\\[\\]\\.,;:|\\s@\\\"]+(\\.[^<>#&%/?~()\\[\\]\\.,;:|\\s@\\\"]+)*)|(\\\".+\\\"))@(([^<>#&%/?~()\\[\\]\\.,;:|\\s@\\\"]+\\.)+[^<>#&%/?~()\\[\\]\\.,;:|\\s@\\\"]+)$");
if (!_PATTERN .matcher(testEmailAddress).matches()) {
System.out.println(true);
} else {
System.out.println(false);
}
}
}