```
String getname(){

    Scanner input = new Scanner(System.in);
    String name;
    System.out.println("Enter your name:");
    name= input.next();

    String name_pattern = "^[A-Za-z]+(\\s[A-Za-z]+)$";//this regex isnt validating Ben Smith
    Pattern pattern = Pattern.compile(name_pattern);
    Matcher regexmatcher = pattern.matcher(name);

    if(!regexmatcher.matches()){
        System.out.println("Name format not correct");
     }

    return name;

}

```

I also need to take the input again and again until the correct format is entered. How do i do that? My current regex prints "Name format not correct" when I input "Ben Smith" though it should not print that because Ben Smith is a valid input!