[R] regex
Ivan Krylov
kry|ov@r00t @end|ng |rom gm@||@com
Tue Sep 17 09:25:20 CEST 2019
On Tue, 17 Sep 2019 10:14:24 +0300
Ivan Krylov <krylov.r00t using gmail.com> wrote:
> '\\[.*\\]'
Sorry, I forgot to take it into account that you don't want the [] in
your units, either. That's still doable, but requires so-called
look-around assertions in the regular expression:
'(?<=\\[).*(?=\\])'
This should match any characters that are preceded by "[" and followed
by "]", but without including the brackets in the match. This requires
passing perl = TRUE to regexpr(). stringr::str_match() understands this
pattern without any additional flags.
--
Best regards,
Ivan
More information about the R-help
mailing list