[R] Regular expressions and 2 dots

Rui Barradas ru|pb@rr@d@@ @end|ng |rom @@po@pt
Fri Jun 28 10:53:21 CEST 2019


Hello,

Please always cc the list.

To know more about the regular expressions used by r read

help("regex")

The one I used is not very complicated.

\\.  match a dot; it is a meta-character so it needs to be escaped.
{2,} repeated at least 2 times, at most an undetermined number of times.
.*   any character (.) repeated zero or more times (*).
$    end of string.

All together now.

"\\.{2,}.*$"  matches at least 2 dots followed by anything until
               the end of the string.

The replacement for this is the empty string "", so what is matched is 
removed.


Hope this helps,

Rui Barradas



Às 09:33 de 28/06/19, ptit_bleu using yahoo.fr escreveu:
> Just a small message to thank you for your fast and working solution.
> I now have to understand it ...
> Nice day.
> 
> _____________________________________
> Sent from http://r.789695.n4.nabble.com
>



More information about the R-help mailing list