https://bugs.freedesktop.org/show_bug.cgi?id=60183
Javier Alfonso <[email protected]> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|RESOLVED |UNCONFIRMED Resolution|INVALID |--- Severity|normal |enhancement Ever confirmed|1 |0 --- Comment #6 from Javier Alfonso <[email protected]> --- I also want to request that function SUBSTITUTE() can be used with regular expression or that a new function will be created for this functionality. I have seen that this was closed for inactivity and leak of information so here we go. For examples we will use the next basic table: A B --------------- 1 | Foo | | --------------- 2 | Boo | | --------------- 3 | Xoooo | | --------------- Note that I'm Spanish so you may see a little bad English :( so sorry in advance. Also will use regex as regular expressions, so it's a little sort. WHAT WE HAVE NOW ----- You can use SUBSTITUTE() function to search for a exact text and replace it. For example: B1 = SUBSTITUTE(A1;"Foo";"Cool") => Cool B2 = SUBSTITUTE(A2;"Foo";"Cool") => Boo This have limitations, you need to specify the search text exactly and many times it isn't know or have many variants to make a SUBSTITUTE() concatenation a doable option. Also we have many functions that accept regex but only to search, for example SEARCH() function, but with this we need to make very complex expressions. WHAT WE WANT TO HAVE ----- A thing that will solve this problem and add a great power to spreadsheets is the addition of regex to substitute function. We have two big alternatives, change SUBSTITUTE() to accept regular expressions or add a new function that accept regular expressions. * Edit SUBSTITUTE() to accept a parameter that enable regular expressions. For example something like `B2 = SUBSTITUTE(A2;".(oo)";"C\1l") => Boo` and `B2 = SUBSTITUTE(A2;".(oo)";"C\1l", 1) => Cool`. This make it compatible with old version. * Edit SUBSTITUTE() to accept regex by default. I think this will confuse the user and don't recommend it. * Add a new function, for example REGEX(text; regex; reemplacement). This (IMO) is the best option, no confuse and add new functionality. REGEX() function definition ------ REGEX(text; regex; replacement; [occurrences]) * text. A cell or text to search in it. * regex. A regular expression that must be matched. * replacement. A text (possibly with backtrack expression) to substitute the matched text. * occurrences. A optional number that indicate how many times you can apply the substitution. For example: B1 = SUBSTITUTE(A1;"([FfBb])(o+)";"\1\2l") => Fool B2 = SUBSTITUTE(A2;"([FfBb])(o+)";"\1\2l") => Bool B3 = SUBSTITUTE(A3;"([FfBb])(o+)";"\1\2l") => Xooool -- You are receiving this mail because: You are the assignee for the bug.
_______________________________________________ Libreoffice-bugs mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/libreoffice-bugs
