Re: [R] using sub with "wildcards", e.g. sub("\\*..", "", "test.a..34")

2008-01-08 Thread jim holtman
This will work: > sub(".*\\.\\.", "", "test.a..34") [1] "34" This say match all characters upto and including the two periods. You have to escape the periods since they have special meaning in regular expression (match a character). On Jan 8, 2008 6:08 PM, Charilaos Skiadas <[EMAIL PROTECTED]>

Re: [R] using sub with "wildcards", e.g. sub("\\*..", "", "test.a..34")

2008-01-08 Thread Charilaos Skiadas
If this is really the case you are dealing with, wouldn't strsplit do the job more easily? On Jan 8, 2008, at 5:47 PM, Thomas Pujol wrote: > I have a text string "test.a..34" > > I wish to extract the text that comes after ".." (e.g. "34"), and > the text that comes before ".." (e.g. "test.

[R] using sub with "wildcards", e.g. sub("\\*..", "", "test.a..34")

2008-01-08 Thread Thomas Pujol
I have a text string "test.a..34" I wish to extract the text that comes after ".." (e.g. "34"), and the text that comes before ".." (e.g. "test.a"). What is a good way to do this? Also, can you help me understand how to use "wildcards" such as "*" with sub, etc? #This seems