[R] Regular Expression and Pmatch

Peter Dalgaard BSA p.dalgaard at biostat.ku.dk
Mon Oct 23 20:52:52 CEST 2000


gopher <radar at orinoco.princeton.edu> writes:

> Hi, I wonder if there's a good intro to the pattern matching using R? I'm a perl
> programer and find it too confusing and complex to use regular expressions under R.
> For instance, why does pmatch("d","ad") returns NULL? How would I call the
> functions in order to match any portion of the string? Under what circumstances shall
> backslush be used? I try to extract all strings with ".d", however just couldnt manage
> to do it? Any ideas? Or I have to write my own regex extension ? TIA.
> -Yu

Try help(regexpr). pmatch does *partial* matching - looks for the
string which the first arg is a prefix (well it's really a bit more
complicated...) in the same manner as when actual arguments are
matched to formals.

-- 
   O__  ---- Peter Dalgaard             Blegdamsvej 3  
  c/ /'_ --- Dept. of Biostatistics     2200 Cph. N   
 (*) \(*) -- University of Copenhagen   Denmark      Ph: (+45) 35327918
~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk)             FAX: (+45) 35327907
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._



More information about the R-help mailing list