I want to use mySQL, or PHP (if too tough in SQL), to get rid of all occurrences of any text between certain strings/tags.
I have a database field that looks like the following:
<chrd>F Gm<br><indx>Here's a little song I wrote You might want to sing it note for note...<br><chrd> Bb C F<br><text>Don't Worry Be Happy<br><text>In every life we have some trouble When you worry you make it double...<br><text>Don't Worry Be Happy
I want to remove the text between the tags <chrd> and <br> (tags included or not). I have tried SELECT substring_index(substring_index(text, '<chrd>', -1), '<br>', 1),'') FROM songs; but returns only the last occurrence ( Bb C F). How can I select all occurrences?
Also, the above returns all the text if there is a song with no chords. I would like it to return empty string.
After I get rid of the chords, I will do multiple REPLACE to remove all the tags, so that I will be left with only the plain text, the lyrics. (This OK, I can do)
Note: I don’t know about regular expressions and procedures