Find repeated pattern in a string of characters using R

前端 未结 1 1602
有刺的猬
有刺的猬 2021-01-12 08:34

I have a large text that contains expressions such as: \"aaaahahahahaha that was a good joke\". after processing, I want the \"aaaaahahahaha\" to

1条回答
  •  清酒与你
    2021-01-12 08:53

    \b(\S+?)\1\S*\b
    

    Use this.See demo.

    https://regex101.com/r/sJ9gM7/46

    For r use \\b(\\S+?)\\1\\S*\\b with perl=TRUE option.

    0 讨论(0)
提交回复
热议问题