I want to validate string with rules:
- string must contain at least one letter
- string can contain only those symbols(but it's not a must): ' , - , ( , )
- if there is a symbol present in the string, it must also contain a letter(at least one 1st bullet)
- only symbols are not allowed
so far I have come up with the following regex:
static personName = XRegExp.cache("^[\\s\\p{L}\\'\\-\\(\\)]+(?=\\S*\\p{L})\\S+$");
which doesn't work correctly. Only "^(?=\\S*\\p{L})\\S+$"
this helps with the letters, I struggle to understand how to add symbols to it so that all rules will be passed, what am I doing wrong?