I am using .Net. I want to match last name which has charecters other than a-z, A-Z, space and single quote and len of charecters should not be between 1-40 . The string that has to be matched is a XML look like this <FirstName>SomeName</FirstName><LastName>SomeLastName</LastName><Address1>Addre1</Address1>
I wrote regualr expression but that is matching only
[a-zA-Z'.\s]{1,40} <LastName>[a-zA-Z'.\s]{1,40}</LastName>
EDIT:LastName tag is missed. But I want to get negation of this expression. Is that possible or should I take different approach?