> x <- 'Mr Jones ate lunch and Mr Smith was tied' > gsub('(Mr\\.*)\\s+\\w+', "\\1 <file://0.0.0.1/> xxxx", x) [1] "Mr xxxx ate lunch and Mr xxxx was tied" > >
On Sat, Sep 20, 2008 at 2:24 AM, Bob Green <[EMAIL PROTECTED]>wrote: > > Hello, >> > > I am hoping for advice as to how I could remove all words immediately > following the words 'Mr' or 'Mr.' in a csv file. For example, the following > phrases are included in lines of text (along with other Mr) that could be > anywhere in the file: "Mr Jones ate lunch" and "Mr Smith was tied". > > > I want to remove the words Jones and Smith (etc) leaving the other text > intact. > > Any suggestions are appreciated, > > regards > > > Bob > > ______________________________________________ > R-help@r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide > http://www.R-project.org/posting-guide.html<http://www.r-project.org/posting-guide.html> > and provide commented, minimal, self-contained, reproducible code. > -- Jim Holtman Cincinnati, OH +1 513 646 9390 What is the problem that you are trying to solve? [[alternative HTML version deleted]] ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.