1

In the code given below I want to replace all occurrences of "<a url>" with "link", but gsub isn't recognizing the repeated occurrences:

stringx<- " word1 word1 word1 <a url> /n word word word <a url> word 
word word <a url> abcd"   
gsub('<{1}.* *>', "link", stringx )

Output: " word1 word1 word1 link abcd"

Desired output: " word1 word1 word1 link word word word link word word word link abcd"

I don't understand what I'm doing wrong Thanks!

Ronak Shah
  • 377,200
  • 20
  • 156
  • 213

0 Answers0