I have a form, where users are to insert musical chords as [Am], [D], etc inside a textarea. A chord letter enclosed by brackets.
I want to prevent users from entering northern europian variations of [H], and have them replaced by english [B] on form submit.
How can I set up a replace function that does something like this:
[H] -> [B]
[Hm] -> [Bm]
[Hm7] -> [Bm7]
[h] -> [H]
[h7] -> [H7]
I should be enough to globally replace H/h inside a bracket with a capital B inside the same bracket.
Is there a smart replace function you would recommend?