Remove the letters between two patterns of strings in R

后端 未结 3 1699
花落未央
花落未央 2020-12-06 01:58

How can I remove the letters between two specific patterns in R?

For instance

a= \"a#g abcdefgtdkfef_jpg>pple\"

I would like to

3条回答
  •  感情败类
    2020-12-06 02:35

    Adding to the previous replies, if you work with a string that looks like "a#g abcdefgtdkfef_jpg>pple ; #__something_else___jpg>", some of these methods will sub the whole string with an expression like "#.*jpg>", and you will get an empty string as a result. To avoid that, you can use R regex "#[^jpg>]+jpg>" that will allow you to match the pattern more selectively.

提交回复
热议问题