Top "Substitution" questions

The action of replacing something with another thing.

JavaScript - Replace all commas in a string

I have a string with multiple commas, and the string replace method will only change the first one: var mystring = "…

javascript string replace substitution
bash: Bad Substitution

#!/bin/bash jobname="job_201312161447_0003" jobname_pre=${jobname:0:16} jobname_post=${jobname:17} This bash script gives me Bad substitution error on Ubuntu. …

string bash ubuntu substitution
Substitute multiple whitespace with single whitespace in Python

I have this string: mystring = 'Here is some text I wrote ' How can I substitute the double, triple (...) whitespace …

python substitution removing-whitespace
Remove all newlines from inside a string

I'm trying to remove all newline characters from a string. I've read up on how to do it, but it …

python string newline substitution
How can I combine multiple nested Substitute functions in Excel?

I am trying to set up a function to reformat a string that will later be concatenated. An example string …

excel excel-formula nested substitution nested-function
How to use a variable in the replacement side of the Perl substitution operator?

I would like to do the following: $find="start (.*) end"; $replace="foo \1 bar"; $var = "start middle end"; $var =~ s/$find/$…

regex perl substitution
Default substituting %s in python scripts

Sometimes in Python scripts I see lines like: cmd = "%s/%s_tb -cm cond+line+fsm -ucli -do \"%s\"" Where …

python string substitution
sed error: "invalid reference \1 on `s' command's RHS"

I run several substitution commands as the core of a colorize script for maven. One of the sed commands uses …

regex sed substitution
Why does my bash code fail when I run it with sh?

I have a line of code that works fine in my terminal: for i in *.mp4; do echo ffmpeg -i "$…

bash sh substitution
sed substitution with Bash variables

I am trying to change the values in a text file using sed in a Bash script with the line, …

bash sed substitution