# word_substitute function

(Shortest import: `from brian2.utils.stringtools import word_substitute)`

brian2.utils.stringtools.word_substitute(expr, substitutions)

  Applies a dict of word substitutions.

  The dict `substitutions` consists of pairs `(word, rep)` where each word `word` appearing in `expr` is replaced by `rep`. Here a ‘word’ means anything matching the regexp `\bword\b`.

  Examples

      >>> expr = 'a*_b+c5+8+f(A)'
      >>> print(word_substitute(expr, {'a':'banana', 'f':'func'}))
      banana*_b+c5+8+func(A)