wolski
2004-Feb-19 15:53 UTC
[R] read.socket - Strange strings. How to force sub to remove all occurences of a pattern?
I am opening a connection to an apache server sending a get and then I am reading from the socket. All works finde except that I am getting some strange strings disrupting the html e.g. <FON\r\nffb\r\nT COLOR ... \r\na48\r\n \r\nffb\r\n They are not frequent ( a few of them) but of course make live hard. I cant observe them with lynx --source they dont occure. I am trying a workaround with sub. But it removes only the first occurence. How I can force sub to remove all occurences of a pattern and not only the first? Eryk
Henrik Bengtsson
2004-Feb-19 17:57 UTC
[R] read.socket - Strange strings. How to force sub to remove all occurences of a pattern?
Hi, here's some classical questions to you; what's your system and what version of R are you using? Could you give a workable code example how you connect to the Apache server? Is the server public so others can test your code? About sub(): you're looking for gsub(). Cheers Henrik Bengtsson> -----Original Message----- > From: r-help-bounces at stat.math.ethz.ch > [mailto:r-help-bounces at stat.math.ethz.ch] On Behalf Of wolski > Sent: den 19 februari 2004 16:53 > To: r-help at stat.math.ethz.ch > Subject: [R] read.socket - Strange strings. How to force sub > to remove all occurences of a pattern? > > > > > I am opening a connection to an apache server sending a get > and then I am reading from the socket. All works finde except > that I am getting some strange strings disrupting the html e.g. > > <FON\r\nffb\r\nT COLOR ... > > \r\na48\r\n > \r\nffb\r\n > > They are not frequent ( a few of them) but of course make live hard.> I cant observe them with lynx --source they dont occure. > > I am trying a workaround with sub. But it removes only the > first occurence. How I can force sub to remove all occurences > of a pattern and not only the first? > > Eryk > > ______________________________________________ > R-help at stat.math.ethz.ch mailing list > https://www.stat.math.ethz.ch/mailma> n/listinfo/r-help > PLEASE > do read the posting guide! > http://www.R-project.org/posting-guide.html > >
wolski
2004-Feb-19 18:15 UTC
[R] read.socket - Strange strings. How to force sub to remove all occurences of a pattern?
Hallo Douglas, Henrik! Thanks a lot for the help with sub and gsub. Eryk. *********** REPLY SEPARATOR *********** On 2/19/2004 at 10:12 AM Douglas Grove wrote:>Did you look at the help page for sub?? > >Read "Details:" > > >On Thu, 19 Feb 2004, wolski wrote: > >> >> >> I am opening a connection to an apache server sending a get and then I >am reading from the socket. >> All works finde except that I am getting some strange strings disrupting >the html >> e.g. >> >> <FON\r\nffb\r\nT COLOR ... >> >> \r\na48\r\n >> \r\nffb\r\n >> >> They are not frequent ( a few of them) but of course make live hard. >> I cant observe them with lynx --source they dont occure. >> >> I am trying a workaround with sub. But it removes only the first >occurence. >> How I can force sub to remove all occurences of a pattern and not only >the first? >> >> Eryk >> >> ______________________________________________ >> R-help at 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 >>