Top "Gsub" questions

Ruby, Lua, R and Awk methods for performing a global pattern substitution.

Remove parenthesis from a character string

I am trying to remove a parenthesis from a string in R and run into the following error: string <…

r string gsub
Replace multiple strings in one gsub() or chartr() statement in R?

I have a string variable containing alphabet[a-z], space[ ], and apostrophe['],eg. x <- "a'b c" I want …

r string gsub
in R, use gsub to remove all punctuation except period

I am new to R so I hope you can help me. I want to use gsub to remove all …

r regex replace gsub
How to remove leading and trailing whitespaces?

I'm using awk '{gsub(/^[ \t]+|[ \t]+$/,""); print;}' in.txt > out.txt to remove both leading and trailing …

awk whitespace gsub removing-whitespace
Replace characters using gsub, how to create a function?

I'm trying to replace characters in a data.frame. I have a solution for this > df <- data.…

r regex gsub
Replace characters in column names gsub

I am reading in a bunch of CSVs that have stuff like "sales - thousands" in the title and come …

r gsub
using gsub in ruby strings correctly

I have this expression: channelName = rhash["Channel"].gsub("'", " ") it works fine. However, I can only substitute 1 character with it. …

ruby string gsub
Remove everything after space in string

I would like to remove everything after a space in a string. For example: "my string is sad" should return "…

r regex gsub
replace "." with space using gsub() in R?

I have data as below, I like to replace "." with space using gsub() but I could not get correct output. …

r gsub
Replace ' with \' in Ruby?

I'm trying to figure out how to replace a quote like ' with something like \'. How would I do …

ruby string gsub