Hi all,

I'm trying to learn how to use regex inside R. I'm far from an expert when
it comes to this, but google is my friend when it comes to finding suitable
pieces of syntax to start building from. For example, this post seems to do
what I want:

http://stackoverflow.com/questions/12258622/regular-expression-to-check-for-repeating-characters
However, how do I implement this in R? gsub()?
For example, with Perl-style regex, are there syntax modifications that
need to be done before it will work with R?

My task is that I want to truncate/limit repeated characters to 3. If I
have the string:
"Looooorem ipsum dolor sit ammmmmmet, consectetur adipiscing eliiiiiiiit"

I want to truncate it to:
"Looorem ipsum dolor sit ammmet, consectetur adipiscing eliiit"

Thank you!

BR,
Josip

        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to