Skip to content

Pattern Matching help

2 messages · Brian Ripley, Thomas J Vogels

#
Try
[1] "b.c"   "d.e.f"
But
[1] "a"     "b_c"   "d_e_f" "p_q,r"
`.' is a special character in a regexp.   You have to escape it by `\', and
that needs to be escaped in R.

Perhaps we need to say more on the help page, but I am reluctant to
try to define the meaning of `regular expression' there ....
#
Prof Brian Ripley <ripley at stats.ox.ac.uk> writes:

<snip>
</snip> 

Since perl is a prerequisite for the installation of R, you might
assume that its man pages are also available.  'man perlre' gives an
overview of the special characters in the subsection "Regular
Expressions".  So, could you refer the reader of the help page for
gsub and friends to the man page of perlre?  (I don't what you would
do for the Windows people...)

Regards,
  -tom