From |@wrence@m|ch@e| @end|ng |rom gene@com  Thu Aug 29 23:29:25 2019
From: |@wrence@m|ch@e| @end|ng |rom gene@com (Michael Lawrence)
Date: Thu, 29 Aug 2019 14:29:25 -0700
Subject: [Rd] Feature request: non-dropping regmatches/strextract
In-Reply-To: <102772513.32513.1567113562904@mail.yahoo.com>
References: <2012653205.221487.1565848601638.ref@mail.yahoo.com>
 <2012653205.221487.1565848601638@mail.yahoo.com>
 <CALK03d2cCoAboDBmr5dhR9+kjGh5=Eg5QAHmKc-qJYm_iGO5mw@mail.gmail.com>
 <102772513.32513.1567113562904@mail.yahoo.com>
Message-ID: <CAOQ5NydKtocPcz-3zVfZMo5K0jkbsF+R2iBvzzPO7fiP=+ZHQg@mail.gmail.com>

I'd be happy to entertain patches or at least more specific
suggestions to improve strextract() and strcapture(). I hadn't
exported strextract(), because I wasn't quite sure how it should
behave. This feedback should be helpful.

Thanks,
Michael

On Thu, Aug 29, 2019 at 2:20 PM Cyclic Group Z_1 via R-devel
<r-devel at r-project.org> wrote:
>
> Thank you, I am aware that there are packages that can accomplish this. I mentioned stringr::str_extract as a function that does not drop empty matches. I think that the behavior of regmatches(..., regexpr(...)) in base R should permit an option to prevent dropping of empty matches both for sake of consistency with the rest of the language (missing data does not yield a dropped index in other sorts of R functions, and an empty match conceptually corresponds with missing data) and facility of use in data.frames. The behavior of regmatches(..., gregexpr(...)) is not objectionable to me, as lists do not drop indices when they contain character(0) vectors. Alternatively, perhaps this should be reflected in the (currently non-exported) strextract.
>
> Best,
> CG
>
> ______________________________________________
> R-devel at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel



-- 
Michael Lawrence
Scientist, Bioinformatics and Computational Biology
Genentech, A Member of the Roche Group
Office +1 (650) 225-7760
michafla at gene.com

Join Genentech on LinkedIn | Twitter | Facebook | Instagram | YouTube



[Rd] Feature request: non-dropping regmatches/strextract
Michael Lawrence