[R] gsub does not support \b?

Uwe Ligges ligges at statistik.tu-dortmund.de
Wed Nov 11 10:17:21 CET 2009



Tan, Richard wrote:
> Hello, can someone help?  How come
>  
>>     gsub("\bINDS\b","INDUSTRIES","ADVANCED ENERGY INDS")
> [1] "ADVANCED ENERGY INDS"


It does, but you need to escape it:

  gsub("\\bINDS\\b","INDUSTRIES","ADVANCED ENERGY INDS")

Uwe Ligges




> not ADVANCED ENERGY INDUSTRIES
>  
> Thanks.
> Richard
> 
> 	[[alternative HTML version deleted]]
> 
> ______________________________________________
> R-help at 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.




More information about the R-help mailing list