Re: [R] Regular Expressions

From: John Bullock <john.bullock_at_stanford.edu>
Date: Tue 13 Jul 2004 - 12:47:15 EST

If you use the RPerl interface
(http://www.omegahat.org/RSPerl/), you can do this simply for any number of expressions by letting Perl do the matching. If "strings" is the array of strings that you want to test, all you need is

    for (@strings) {

        if (/thomas/ && /perl/ && /prog/) {do something}
        }

But I don't know a simple way to do it in R.

--John

>
>
> Hi,
>
> Is there a way to use regular expressions to capture
two or more words in a
> sentence? For example, I wish to to find all the lines
that have the words "thomas",
> "perl", and "program", such as "thomas uses a program
called perl", or "perl is a
> program that thomas uses", etc.
>
> I'm sure this is a very easy task, I would greatly
appreciate any help. Thanks!
>
> Sangick
>
> ______________________________________________
> R-help@stat.math.ethz.ch mailing list
> https://www.stat.math.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide!
http://www.R-project.org/posting-guide.html



R-help@stat.math.ethz.ch mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Received on Tue Jul 13 12:56:44 2004

This archive was generated by hypermail 2.1.8 : Wed 03 Nov 2004 - 22:54:54 EST