[Libreoffice-bugs] [Bug 113977] New: Implement REGEXEXTRACT function
bugzilla-daemon at bugs.documentfoundation.org
bugzilla-daemon at bugs.documentfoundation.org
Tue Nov 21 17:19:24 UTC 2017
https://bugs.documentfoundation.org/show_bug.cgi?id=113977
Bug ID: 113977
Summary: Implement REGEXEXTRACT function
Product: LibreOffice
Version: 5.4.3.2 release
Hardware: All
OS: All
Status: UNCONFIRMED
Severity: normal
Priority: medium
Component: Calc
Assignee: libreoffice-bugs at lists.freedesktop.org
Reporter: ddascalescu+freedesktop at gmail.com
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:
https://help.libreoffice.org/Calc/Text_Functions 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 https://support.google.com/docs/answer/3098244?hl=en,
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
--
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/libreoffice-bugs/attachments/20171121/e699c489/attachment.html>
More information about the Libreoffice-bugs
mailing list