[Rd] 'gsub' not perl compatible?

Lipatz Jean-Luc jean-luc.lipatz at insee.fr
Fri Jul 21 11:26:34 CEST 2017


Hi all,

Working on some SAS program conversions, I was testing this (3.4.0 Windows, but also 2.10.1 MacOsX):
gsub("b?","!","abc",perl=T)

which returns
[1] "!a!c!"

that I didn't understand.

Unfortunately, asked for the same thing SAS 9.4 replies : "!a!!c!", and so does Perl (Strawberry 5.26), a more logical answer for me.
Is there some problem with PCRE or some subtility that I didn't catch?

Results are similar with * instead of ?
and there is a similar issue with the lazy operator:
gsub("b??","!","abc",perl=T) gives : "!a!b!c!", while the other softwares give "!a!!!c!"


Thanks

Jean-Luc LIPATZ




	[[alternative HTML version deleted]]



More information about the R-devel mailing list