Java OCA OCP Practice Question 3178

Question

You want to write a regex to match an e-mail address.

The e-mail address should not start with a digit and should end with ".com".

Which one of the following regex will satisfy this requirement?

  • A. "\b\w+@\w+\.com\b"
  • B. "\b\D\w*@\w+\.com\b"
  • C. "\b\D\w+@\w+\.com\b"
  • D. None of the above


B.

Note

"\b" is used to mark word boundaries, "\D" is used to match any non-digit number, and "\w*" is used to match any word of length zero or more.

The remaining part is similar to that used earlier.




PreviousNext

Related