From jean-luc.lipatz at insee.fr  Fri Jul 21 11:26:34 2017
From: jean-luc.lipatz at insee.fr (Lipatz Jean-Luc)
Date: Fri, 21 Jul 2017 09:26:34 +0000
Subject: [Rd] 'gsub' not perl compatible?
Message-ID: <FEF25E56AFC7064784FA97C576467E0AC7ACD337@pdexchbalwst01.ad.insee.intra>

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]]



[Rd] 'gsub' not perl compatible?
Lipatz Jean-Luc