Skip to content
Prev 369691 / 398503 Next

regular expression help

Zitat von Ashim Kapoor <ashimkapoor at gmail.com>:
In Perl, '.' matches anything but a newline.

In R, '.' matches any character.

   test <- "hello\n1"
   regexpr(".*[0-9]", test)
   ## [1] 1
   ## attr(,"match.length")
   ## [1] 7
   ## attr(,"useBytes")
   ## [1] TRUE

   regexpr(".*[0-9]", test, perl = TRUE)
   ## [1] 7
   ## attr(,"match.length")
   ## [1] 1
   ## attr(,"useBytes")
   ## [1] TRUE