[R] Search a function name in a string

2007-07-03 Thread NOEL Yvonnick
Hello, I am trying to find a function name in a string that expresses a functional form : s = blabla...S(var)...blabla I would like to detect the pattern S(*) in s. I am no guru at regular expressions. Just tried : grep(S(.*),c(S(a),CSP)) [1] 1 2 I expected the pattern to be retrieved

Re: [R] Search a function name in a string

2007-07-03 Thread Uwe Ligges
NOEL Yvonnick wrote: Hello, I am trying to find a function name in a string that expresses a functional form : s = blabla...S(var)...blabla I would like to detect the pattern S(*) in s. I am no guru at regular expressions. Just tried : grep(S(.*),c(S(a),CSP))

Re: [R] Search a function name in a string

2007-07-03 Thread Gabor Grothendieck
Parnetheses have special meaning so they must be escaped or specify a character class of 1: grep(S\\(.*\\),c(S(a),CSP)) [1] 1 grep(S[(].*[)],c(S(a),CSP)) [1] 1 On 7/3/07, NOEL Yvonnick [EMAIL PROTECTED] wrote: Hello, I am trying to find a function name in a string that expresses a