I have a large text that contains expressions such as: \"aaaahahahahaha that was a good joke\". after processing, I want the \"aaaaahahahaha\" to
\"aaaahahahahaha that was a good joke\".
\"aaaaahahahaha\"
\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.
r
\\b(\\S+?)\\1\\S*\\b
perl=TRUE