<html>
    <head>
      <base href="https://bugs.documentfoundation.org/">
    </head>
    <body>
      <p>
        <div>
            <b><a class="bz_bug_link 
          bz_status_CLOSED  bz_closed"
   title="CLOSED NOTABUG - When using regex and find.text different positions (begining or the end of string) are returned."
   href="https://bugs.documentfoundation.org/show_bug.cgi?id=118505#c4">Comment # 4</a>
              on <a class="bz_bug_link 
          bz_status_CLOSED  bz_closed"
   title="CLOSED NOTABUG - When using regex and find.text different positions (begining or the end of string) are returned."
   href="https://bugs.documentfoundation.org/show_bug.cgi?id=118505">bug 118505</a>
              from <span class="vcard"><a class="email" href="mailto:mkotl@ibb.waw.pl" title="Maciej Kotliński <mkotl@ibb.waw.pl>"> <span class="fn">Maciej Kotliński</span></a>
</span></b>
        <pre>Actually I've got this problem when striping the last digit (and possibly a
character) from the name names of samples from some analyses.
I've got such names as in first column and would like to strip last digit and
possibly letter. I was surprised to get different results for "KHe3r" and
"KHe3" when using "[0-9]?$". One can deal with the problem with
"[0-9][a-z]{0,1}$" which work as I expected.

 =SZUKAJ.TEKST(REGEX; AX)

         "[0-9]?$"  stripped text*  "[0-9][a-z]{0,1}$"  stripped text*
K-7dpi3      7          K-7dpi             7             K-7dpi
KHe1         4          KHe                4             KHe
KHe2s        6          KHe2s              4             KHe
KHe3         4          KHe                4             KHe
KHe3r        6          KHe3r              4             KHe
KL101a       7          KL101a             5             KL10
KL102        5          KL10               5             KL10
KL103        5          KL10               5             KL10
KL10-3dpi1  10          KL10-3dpi         10             KL10-3dpi
KL10-3dpi2  10          KL10-3dpi         10             KL10-3dpi
MM-10dpi1    9          MM-10dpi           9             MM-10dpi

*stripped text returned by =FRAGMENT.TEKSTU(A1; 1; [result from the coulumn
with position]-1)

Thank you for clarifying the problem. I describe the solution which works for
me. Maybe it will be helpful for somebody.</pre>
        </div>
      </p>


      <hr>
      <span>You are receiving this mail because:</span>

      <ul>
          <li>You are the assignee for the bug.</li>
      </ul>
    </body>
</html>