RegEx for credit-card-numbers with spaces/dash delimiters

I’ve used regular expressions from that supports delimiters spaces/dashes, e.g. “3714-496353-98431” or “3714 496353 98431”. (by the way I’ve added Diner’s Club pattern  ((?:30[0-59]|(?:(?:36|38|39)[0-9]))[0-9]{11}) even they are obsolete now)
Unfortunately they use backreferences \1 in individual credit card matches, which doesn’t work if I use alternatives (Visa)|(Master)|(Amex).
I replaced numbered capturing groups with named capturing groups .
Javascript and .Net format for named groups are different. I’ve done initially using ?P syntax
(?<!\d)(?:(4\d{3}((?P[\ \-]?)(?:\d{4}(?P=DelimVI)){2}\d(?:\d{3})?)|(5([1-5]\d{2})(?P[\ \-]?)\d{4}(?P=DelimMC)\d{4}(?P=DelimMC)\d{4})|(3[47]\d\d(?P[\ \-]?)\d{6}(?P=DelimAX))\d{5}))(?!\d)
and then had to translate to .Net syntax
(?<!\d)(?:(4\d{3}(?’DelimVI'[\ \-]?)(?:\d{4}\k’DelimVI’){2}\d(?:\d{3})?)|(5([1-5]\d{2})(?’DelimMC'[\ \-]?)\d{4}\k’DelimMC’\d{4}\k’DelimMC’\d{4})|(3[47]\d\d(?’DelimAX’)[\ \-]?)\d{6}\k’DelimAX’\d{5}))(?!\d)
I’ve tested Javascript syntax in RegEx101 (see, but for .Net I had to use and they are not comparable-RegEx101 is significantly user friendlier.

#credit-cards, #regex, #regular-expressions