I have a list of names for which I am trying to implement proper casing- the list of names are as follows
- DR. JOHN GROVE WHITE
- RONALD MCDONALD
- GORDON SAINT JOHN
- ARTHUR STEVENS
- GAIL VAN STOLK
- ANWAR AL-SADAT
- SYMS III, ROGER
- ROGER SYMS V
For the above list I have implemented regex pattern. The regex pattern are working properly when i put then on regex testing websites but it is not working in code
Regex.IsMatch(value, @"(/^(van|von|der|la|d[aeio]|d[ao]s|dit)[\s,]*$/i)")
The above is not matching when i pass value as van in code
Regex.IsMatch(value, @"(/(^|\s)+(Mc|[DO]\'|St\.|St[\.]?[\s]|Dewolf)/i)")
The above is not working when i pass value as Mcdonald
Regex.IsMatch(value, @"(/(^|\s*)(Mac)(allist|arth|b|c(allu|art|ask|l|r|ull)|d|f|g|i(nn|nty|saa|v)|kinn|kn|l(a|ea|eo)|m|na[mu]|n[ei]|ph|q|ra|sw|ta|w)/i)")
The above regex is not matching when i pass value as Macdonald
I am not able to find out is there any issue in regex.Please help me out for the above.Thanks in advance