I would like to replace "\r\n" with "" in a character string, where "\r\n" exists only between < and >, how could I do that?
Initial: characterString = "<XML><tag1 id=\"F\r\n2\"></t\r\nag1>\r\n<tag\r\n2></tag2></XML>" Result: characterString = "<XML><tag1 id=\"F2\"></tag1>\r\n<tag2></tag2></XML>" Tried with sub(below) but it only replaces the first instance and I am not sure how to pattern match so that it only replaces \r\n that exist within tags(< and >). sub("\r\n", "", charStream) -- View this message in context: http://www.nabble.com/Pattern-Matching-Replacement-tp18014978p18014978.html Sent from the R help mailing list archive at Nabble.com. ______________________________________________ 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.