<html>
<head>
<base href="https://bugs.documentfoundation.org/">
</head>
<body><table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Bug ID</th>
<td><a class="bz_bug_link
bz_status_UNCONFIRMED "
title="UNCONFIRMED - Implement REGEXEXTRACT function"
href="https://bugs.documentfoundation.org/show_bug.cgi?id=113977">113977</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>Implement REGEXEXTRACT function
</td>
</tr>
<tr>
<th>Product</th>
<td>LibreOffice
</td>
</tr>
<tr>
<th>Version</th>
<td>5.4.3.2 release
</td>
</tr>
<tr>
<th>Hardware</th>
<td>All
</td>
</tr>
<tr>
<th>OS</th>
<td>All
</td>
</tr>
<tr>
<th>Status</th>
<td>UNCONFIRMED
</td>
</tr>
<tr>
<th>Severity</th>
<td>normal
</td>
</tr>
<tr>
<th>Priority</th>
<td>medium
</td>
</tr>
<tr>
<th>Component</th>
<td>Calc
</td>
</tr>
<tr>
<th>Assignee</th>
<td>libreoffice-bugs@lists.freedesktop.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>ddascalescu+freedesktop@gmail.com
</td>
</tr></table>
<p>
<div>
<pre>Description:
Extracting a substring from a string is a royal pain with the existing text
function. It has to be done using a combination of MID(), LEFT() and awkward
repetitive arithmetic.
Steps to Reproduce:
<a href="https://help.libreoffice.org/Calc/Text_Functions">https://help.libreoffice.org/Calc/Text_Functions</a> only lists functions that
return the start of a found string, or that extract strings based on an offset
and number of characters (the latter causing the repetitive arithmetic I
mentioned. Here's my best attempt to extract a currency value for JPY:
A1: EUR:1.2,JPY:0.02,AUD:0.9,...
A2: =SEARCH("(?<=JPY:)\d", A1) // ← value starts
A3: =FIND(",", A7, SEARCH("(?<=JPY:)\d", A1)) // ← value ends right before
that
A4: =MID(A1, SEARCH("(?<=JPY:)\d", A1), FIND(",", A1, SEARCH("(?<=JPY:)\d",
A1)) - SEARCH("(?<=JPY:)\d", A1)) // standalone formula #facepalm
Actual Results:
Horrible formulas
Expected Results:
Per the documentation at <a href="https://support.google.com/docs/answer/3098244?hl=en">https://support.google.com/docs/answer/3098244?hl=en</a>,
REGEXEXTRACT would be far, far simpler:
=REGEXEXTRACT(A1, "(?<=JPY:)[^,]+")
Reproducible: Always
User Profile Reset: No
Additional Info:
A user cares a lot more about the actual substring they want to extract, than
about its offset and length within the original string.
User-Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like
Gecko) Chrome/62.0.3202.89 Safari/537.36</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>