I have some text that looks like this:
[Verse 1]
[B]This is a song with chords [D]and lyrics
Blah [Am7+9d]blah blah [C]blah blah
[Verse 2]
This [C]is the verse
This is the [G]verse
[Chorus]
This is [E#]the Chorus
This is the Chorus
[Bridge]
This is [F]the bridge
This is [Am]the bridge
I want to replace all the chords ([A],[Am], [A#], [B], [C] etc all the way to [G]) so I can just show the lyrics.
Here is my current code that almost works:
$line = preg_replace('~\[([A-G].*?)\]~', '', $line);
This works prefect but it removes [Chorus] and [Bridge] because they start with C and B.
How do I still make it work perfectly but not remove the [Chorus] and the [Bridge]?
$line = preg_replace('~\[(?!Chorus|Bridge)[A-G].*?\]~', '', $line);