title: How to get the last 4 characters only from a substring with variable length of characters each time
body: <p>Im optimizing an invoice for xml and I want to have the last 4 characters only of an variable. The variable can have different length of characters for each invoice I receive, but I only want to have the last 4 characters as a result.</p>
  
  <p>I already tried it with a substring code, but then I need to give a specific length where the code needs to get the last 4 charactes from.</p>
  
  <p>Code i Used:</p>
  
  <pre><code>&lt;xsl:template match="/"&gt;
     &lt;xsl:for-each select="/x:Invoice"&gt;
        &lt;xsl:if test="."&gt;&lt;xsl:value-of select="substring(translate(cbc:Note,' ',''),27,4)"/&gt;&lt;/xsl:if&gt;
     &lt;/xsl:for-each&gt;
  &lt;/xsl:template&gt;
  </code></pre>
  
  <p>this is the code of an Invoice:</p>
  
  <pre><code>&lt;UBLVersionID&gt;2.0&lt;/UBLVersionID&gt;
  &lt;CustomizationID&gt;1.0&lt;/CustomizationID&gt;
  &lt;ProfileID&gt;PowerOnline&lt;/ProfileID&gt;
  &lt;ID&gt;194545&lt;/ID&gt;
  &lt;IssueDate&gt;2019-05-16&lt;/IssueDate&gt;
  &lt;InvoiceTypeCode&gt;1&lt;/InvoiceTypeCode&gt;
  &lt;Note&gt;FB - bestelling voor HH7416&lt;/Note&gt;
  &lt;TaxPointDate&gt;2019-05-16&lt;/TaxPointDate&gt;
  &lt;DocumentCurrencyCode&gt;EUR&lt;/DocumentCurrencyCode&gt;
  &lt;LineCountNumeric&gt;7&lt;/LineCountNumeric&gt;
  &lt;OrderReference&gt;
  &lt;ID&gt;Invoice of an supplier&lt;/ID&gt;
  &lt;SalesOrderID&gt;19538&lt;/SalesOrderID&gt;
  &lt;IssueDate&gt;2019-04-30&lt;/IssueDate&gt;
  </code></pre>
  
  <p>Expected result is the last4 characters of /x:Invoice/cbc:Note so 7416. The note can sometimes be FB - HH6464 so i always want to have the last 4 characters of that cbc:Note</p>