Test

#include <iostream>
#include <string>
#include <regex>

using namespace std;

class student
{
    string name;
    string address;
    string email;
    char password[20];
    char regno[9];
    int age;
    bool gender; // -1 is female, 0 is male (FALSE -> MALE, TRUE -> FEMALE)
    int height;
    int weight;
    
    public:
    void validateName(string n)
    {
        if (regex_match(n, regex (R"(([A-Za-z]*/s?)+)")))
        {
            setName(n);
        }
        else
        {
            cout<<"INVALID NAME"<<endl;
        }
    }
    void setName(string n)
    {
        name = n;
    }
};

int main(){
    int opt=1;
    student s1;
    while (opt != 0)
    {
        cout<<"ENTER OPT:"; cin>>opt;
        string nameinp;
        cin>>nameinp;
        s1.validateName(nameinp);
    }
}