So /[D|d]/ will match "|" which wasn't the intention. Presumably the intention was /(D|d)/, but a plain /[Dd]/ is cleaner.