What is the regular expression to match any email address in a string?
Answer options
A
[a-zA-Z0-9+_.-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}
B
[a-z]+@[a-z]+
C
\w+@\w+
D
[\w.-]+@[\w.-]+
Correct answer: [a-zA-Z0-9+_.-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}
Explanation
Quick AnswerThe correct answer is [a-zA-Z0-9+_.-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,} because it directly addresses the core logic of Java Programming.
This question has been retained as-is due to its unique context.