Top "Gsub" questions

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

Replacing the specific values in columns of data frame using gsub in R

I have data.frame as follows > df ID Value A_001 DEL-1:7:35-8_1 A_002 INS-4l:5_74:d B_023 0 C_891 2 D_787 8 …

regex r gsub
Ruby post title to slug

How should I convert a post title to a slug in Ruby? The title can have any characters, but I …

ruby string lowercase gsub
Ruby/Rails working with gsub and arrays

I have a string that I am trying to work with in using the gsub method in Ruby. The problem …

ruby-on-rails ruby gsub
Remove special characters from data frame

I have a matrix that contains the string "Energy per �m". Before the 'm' is a diamond shaped symbol with …

r regex gsub non-printing-characters
R - gsub replacing backslashes

I would like to use gsub to replace every occurrence of a backslash in a string with 2 backslashes. Currently, what …

regex r gsub
Applying gsub to various columns

What is the most efficient way to apply gsub to various columns? The following does not work x1=c("10%","20%","30%") x2=…

r dataframe gsub
Using gsub to replace a particular character with a newline (Ruby, Rails console)

Annoying problem. I am trying to replace all semicolon characters in my Model's description field with newline characters (\n). The …

ruby-on-rails ruby string newline gsub
How to determine if there is a match an return true or false in rails?

I want to create a test that returns either true or false for email handling. For now, if the email …

ruby-on-rails ruby regex ruby-on-rails-3 gsub
removing trailing spaces with gsub in R

Does anyone have a trick to remove trailing spaces on variables with gsub? Below is a sample of my data. …

r gsub
Removing leading zeros from alphanumeric characters in R

I have a character vector d with alphanumeric characters d <- c("012309 template", "separate 00340", "00045", "890 098", "3405 garage", "matter00908") d [1] "012309 template" "separate 00340" "00045" "890 098" "3405 …

regex string r character gsub