Using Sphinx 1.2.3 and given this RST snippet:
.. code-block:: xml
|version|
and in conf.py I have:
version = '1.0.2'
How do you ensure that the above RST snippet renders as:
…
Is it possible to substitute characters according to a list in Lua, like tr in Perl? For example, I would like to substitute A to B and B to A (e.g. AABBCC becomes BBAACC).
In Perl, the solution would be $str ~= tr/AB/BA/. Is there any native way of…
Is there a way to do simultaneous substitutions with s///? For instance, if I have a string with a number of 1s, 2s, 3s, etc, and I want to substitute 1 with "tom", and 2 with "mary", and 3, with "jane", etc?
my $a = "13231313231313231";
say $a ~~…
I need to scrub a column of names in Excel to eliminate all non-Alpha characters including periods, commas, spaces, hyphens and apostrophes.
EXAMPLE:
Change O'Malley-Smith, Tom, Jr. to OMALLEYSMITHTOMJR
The client requires this to be an Excel…
I am struggling with awk substitution, for some reason the following code does not substitute anything, it just prints the output unaltered. Can anyone see what I am missing here? Any help would be very much appreachiated! (PS! The $DOCPATH and…
I tried implementing a function let with the following semantics:
> let(x = 1, y = 2, x + y)
[1] 3
… which is conceptually somewhat similar to substitute with the syntax of with.
The following code almost works (the above invocation for instance…
I've been making a lot of changes to my .vimrc lately, and somewhere along the line I've introduced an undesirable feature. When performing a substitution command where the search token appears more than once per line, only the first token is…
my question seems to be general, but i can't find any answers.
In sed command, how can you replace the substitution pattern by a value returned by a simple bash function.
For instance, I created the following function :
function parseDates(){
…
We have private git repos for a number of Ansible roles. The repo hosts vary from site to site, for example:
Site1 uses https://gitforsite1.ourdomain.com
Site2 uses https://gitforsite2.ourdomain.com
What I want is to have a single…
I have this string
message = '10100010011'
and this dictionary
codes = {97: '1', 98: '01', 107: '001', 114: '000'}
and I need to substitute the original message using the dictionary to something like this
[97, 98, 114, 97, 107, 97]
I tried my…
I recently found a substitute command for vim where the author had the / replaced by a ! like this: :%s!foo!bar and I don't understand the difference with the traditionnal :%s/foo/bar.
I searched some documentation on this syntax but I didn't find…
What's the best way to take some plain text (not PHP code) which contains PHP-style variables, and then substitute in the value of the variable. This is kinda hard to describe, so here's an example.
// -- myFile.txt --
Mary had a little $pet.
// --…
I want to replace the text of matched re patterns in a string and can do this using re.sub(). If I pass it a function as the repl argument in the call it works as desired, as illustrated below:
from __future__ import print_function
import…
In Hadley's Advanced R book, there is a piece of code that I cannot understand the output.
f <- function(x) substitute(x)
g <- function(x) deparse(f(x))
g(1:10)
g(x)
g(x + y ^ 2 / z + exp(a * sin(b)))
Why do they all return "x"? Especially when
g…