Java Programming
primer-original-v2mediumJava Programming05 Regular Expressionprimer-original-v2

The first name of a person should contain only alphabets and space. Which of the following regular expression will match the requirement?

Answer options

A
Which of the following regular expression will match the requirement?
B
[a-zA-Z ]
C
[\\s]+
D
[a-zA-Z ]+
E
[\\s]

Correct answer: [a-zA-Z ]

Explanation

Quick AnswerThe correct answer is [a-zA-Z ] because it directly addresses the core logic of Java Programming.

This question has been retained as-is due to its unique context.

Related Java Programming questions

Practice more Java Programming questions

PrimerPrep has independently reviewed practice questions and coding exercises — all free.