[
and ]
are specail character in a regex, you have to escape them:
$patterns[] = '/data-note="\[' . $oldKey . '\]/';
Moreover I guess you want simply:
$patterns[] = '/data-note="' . $oldKey . '"/';
Change also the replacement part:
$replacements[] = 'data-note="' . $newKey . '"';