Just as a warning this post contains profanity (apologies in advance).
In R I am trying to do a webscraping project with rap song lyrics. I have scraped lyrics from Wu Tang songs from a site called AZlyrics.
Let's say I have a two string of lyrics like this:-
string1 = "Bring da fuckin ruckus...[Chorus]"
string2 = "I scream on ya ass like your dad, bring it on...[Chorus][Verse Four: The Genius/GZA]"
I would like to remove [....]
from my strings such that the two strings should become:
""Bring da fuckin ruckus..."
"I scream on ya ass like your dad, bring it on..."
I have been trying to do this with
stringr::str_replace(string1, "\[.*?\]", "")
but I get this error:
Error: '\[' is an unrecognized escape in character string starting ""\["
I am quite unfamiliar with how regex works so I am not sure how to fix this.