Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

I have a question \"The name must be of non-zero length and consist of only lett

ID: 3637597 • Letter: I

Question

I have a question "The name must be of non-zero length and consist of only letters and at most one blank, which cannot be the first or last character."

Can't figure out the Regex, I think this statement is correct
This is for an API, so it would be
Regex = [something here]

public void setName(String name) throws IllegalArgumentException
{
String newname = name.split(Regex);
if (!name.isEmpty() && newname)
{
this.name = name;
}
else
{
throw new IllegalArgumentException();
}
return;
{

Thanks.

Explanation / Answer

Regex = [A-Za-zs{2,}]