here is my validation rule
OR(
NOT(REGEX(RIGHT(FirstName,LEN(FirstName)-1),"[\\p{L}\\s\\-.]*$")),
NOT(REGEX(LEFT(FirstName,1),"[\\p{L}\\s.]*$")),
(REGEX(LEFT(FirstName,1),"[\\p{L}\\s.]$"))
)
I am Entering contact in test class
Contact con = new Contact();
con.firstname = 'Test';
con.lastname = 'Warner';
con.AccountId = acc.id;
insert con;
First Character is Capital and not special character allow. i'm following this validation but it throw error in test class is
System.DmlException: Insert failed. First exception on row 0; first error: FIELD_CUSTOM_VALIDATION_EXCEPTION, Special characters are not allowed in contacts First Name / Last Name: []