Top "Replace" questions

Replacing is the action of searching a string for a sub-string and replacing it with a different string.

How do i replace [] brackets using SED

I have a string that i am want to remove punctuation from. I started with sed 's/[[:punct:]]/ /g' But …

shell replace sed ksh brackets
Remove empty lines from txtfiles, remove spaces from start and end of line

Which one would be better: sed -e '/^$/d' *.txt sed 'g/^$/d' -i *.txt Also, how do I remove …

bash sed text-files spaces replace
Replace spaces with dash and remove prefix from string

I'm using this to remove spaces and special characters and convert characters to lowercase: ''.join(e for e in …

python string replace prefix
Replace \\ with \ in C#

I have a long string (a path) with double backslashes, and I want to replace it with single backslashes: string …

c# string replace escaping verbatim-string
Python recursively replace character in keys of nested dictionary?

I'm trying to create a generic function that replaces dots in keys of a nested dictionary. I have a non-generic …

python dictionary replace nested character
Why does re.sub replace the entire pattern, not just a capturing group within it?

re.sub('a(b)','d','abc') yields dc, not adc. Why does re.sub replace the entire capturing group, …

python regex python-3.x replace capturing-group
Replace sequence of bytes in binary file

What is the best method to replace sequence of bytes in binary file to the same length of other bytes? …

c# replace byte binaryfiles
Escape space with backslash in java

I want to replace spaces from path string. I tried below but doesn't seems to be working : String path = "/Users/…

java string replace escaping replaceall
Simplify replacement of date object with "today" and "yesterday" strings in Java static method

I have following method that I would like to make shorter or faster if nothing else. Please all comments are …

java date replace simplify
Replacing double backslashes with single backslash

I have a string "\\u003c", which belongs to UTF-8 charset. I am unable to decode it to unicode because …

java string character-encoding replace backslash