Logmanager documentation
Toggle Dark/Light/Auto mode Toggle Dark/Light/Auto mode Toggle Dark/Light/Auto mode Back to homepage

Text replace

Block is used to relace string in a string. For example: in text XY replace YY to AA.

This function will search XY text and replace all occurences of YY to AA.

Block accepts string or variable as an input and this input is required.

Output of the block is replaced string according to provided inputs.

In case provided input is not string block returns None.

Block XML representation

<xml xmlns="http://www.w3.org/1999/xhtml">
  <variables></variables>
  <block type="def" id="1" deletable="false" x="60" y="20">
    <statement name="STACK">
      <block type="dictionaries_set_index" id="mk(M$B%`HuanV9;bW{]R">
        <mutation at="true"></mutation>
        <value name="VALUE">
          <block type="message" id="d/!0xWXe^w9yM_0pZl*_">
            <field name="OBJECT">msg</field>
          </block>
        </value>
        <value name="AT">
          <block type="text" id="Wgz#cO.5|i$_/j?1+3Qm">
            <field name="TEXT">original</field>
          </block>
        </value>
        <value name="TO">
          <block type="message" id="h6h/`lCI)#N]1-s_]H~]">
            <field name="OBJECT">raw</field>
          </block>
        </value>
        <next>
          <block type="dictionaries_set_index" id="k]kRF0PD~K}JR*!skJnk">
            <mutation at="true"></mutation>
            <value name="VALUE">
              <block type="message" id="!Fk|54LX!:.M[{D#ul*^">
                <field name="OBJECT">msg</field>
              </block>
            </value>
            <value name="AT">
              <block type="text" id="Y)2jnzJm+U4Z:+?CoJ?G">
                <field name="TEXT">replace</field>
              </block>
            </value>
            <value name="TO">
              <block type="text_replace" id="bx@D{wD)HGI{c?LD1I{q">
                <value name="VALUE">
                  <block type="message" id="MN|k8.Y$emY4/!LN|%yl">
                    <field name="OBJECT">raw</field>
                  </block>
                </value>
                <value name="OLD">
                  <block type="text" id="p,tEw;ioy/_@+b8x3l][">
                    <field name="TEXT">example</field>
                  </block>
                </value>
                <value name="NEW">
                  <block type="text" id="F8t:sC(JZG}]LsMym#~k">
                    <field name="TEXT">test</field>
                  </block>
                </value>
              </block>
            </value>
            <next>
              <block type="statement_return" id="0#aylF+A`Aq/Z5FM?DlS"></block>
            </next>
          </block>
        </next>
      </block>
    </statement>
  </block>
</xml>

Example of visual representation

Block "Text replace"

Block “Text replace”

Example of block usage

Example of "Text replace" block

Example of “Text replace” block

Block text replace is used to find all occurrences of example and replace them with test.

Processing result

Results of "Text replace" block

Results of “Text replace” block