I presume that you want it to work for all patterns 'ab.*d' that don't contain the letter "n" or "N", such that "abCDnMMd" does not produce a valid match while "abCDMMdn" does. If that's the case then, try this pattern:
pattern = 'ab((\W*[a-mA-Mo-zO-Z0-9]*\W*)*)d';
\W* => zero or more non-word characters
[a-mA-Mo-zO-Z]* => a group of zero or more upper or lowercase letters of the alphabet excluding "n" or "N".