Re: [R] question of R to do perl matching and matched string extraction

2008-10-08 Thread jim holtman
Is this what you want: > x <- "/pages-cell.net/deepan/sony/" > z <- gsub("/(.*)/", "\\1", x) > > z [1] "pages-cell.net/deepan/sony" On Wed, Oct 8, 2008 at 8:20 PM, Waverley <[EMAIL PROTECTED]> wrote: > Hi, > > I want to extract some of the substring via pattern recognition. But > I don't know

[R] question of R to do perl matching and matched string extraction

2008-10-08 Thread Waverley
Hi, I want to extract some of the substring via pattern recognition. But I don't know how to do it in R. In perl: my $url = "/pages-cell.net/deepan/sony/"; if($url =~ m/\/(.*)\//g) { my @result = $1; return @result; } How does the same work in R? Thanks much in advance -- Waverley @ Palo Al