I found this regex on another post in SO
\b(\(*[CDEFGAB](?:b|bb)*(?:\+|#|##|dim|sus|maj|min|aug|m|M|°|[0-9])*[\(]?[\d\/]*[\)]?(?:[CDEFGAB](?:b|bb)*(?:#|##|dim|sus|maj|min|aug|m|M|°|[0-9])*[\d\/]*)*\)*)\b
this regex works great when I use it with preg_replace
, however when it's found the A#
B#
C#
D#
E#
F#
G#
(not followed by m
like G#m
, in this case G#m
is works just fine).
for example the following lyric will be highlighted F
and G#m
when I use the regex in preg_replace($regex, '<span class="_c">$1</span>', $lyrics)
F#
Angel eyes,
G#m
Why won’t you let me apologise?
I am stucked, and not so good at regex. any help would be appreciated. thanks in advance