[Libreoffice-commits] help.git: source/text

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Thu Nov 29 20:17:30 UTC 2018


 source/text/scalc/01/func_regex.xhp |    9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

New commits:
commit 5f6e0b4ea97c5011a80613fc21a703d2178a8c6e
Author:     Eike Rathke <erack at redhat.com>
AuthorDate: Thu Nov 29 21:04:48 2018 +0100
Commit:     Eike Rathke <erack at redhat.com>
CommitDate: Thu Nov 29 21:17:09 2018 +0100

    Occurrence number as REGEX() 4th argument, tdf#113977 tdf#121084
    
    Change-Id: I42be8bbc4e7c11e09cb66bf12f164c4fc565b54b
    Reviewed-on: https://gerrit.libreoffice.org/64276
    Reviewed-by: Eike Rathke <erack at redhat.com>
    Tested-by: Jenkins

diff --git a/source/text/scalc/01/func_regex.xhp b/source/text/scalc/01/func_regex.xhp
index f83cfac18..bd08223d5 100644
--- a/source/text/scalc/01/func_regex.xhp
+++ b/source/text/scalc/01/func_regex.xhp
@@ -27,15 +27,18 @@
         <paragraph id="par_id541542230672101" role="paragraph" xml-lang="en-US"><variable id="func_regex_desc"><ahelp hid=".">Matches and extracts or optionally replaces text using regular expressions.</ahelp></variable></paragraph>
     </section>
     <embed href="text/scalc/01/ful_func.xhp#func_head_syntax"/>
-    <paragraph role="code" id="par_id701542231253817" xml-lang="en-US">REGEX( Text ; Expression [ ; [ Replacement ] [ ; Flags ] ] )</paragraph>
+    <paragraph role="code" id="par_id701542231253817" xml-lang="en-US">REGEX( Text ; Expression [ ; [ Replacement ] [ ; Flags|Occurrence ] ] )</paragraph>
     <paragraph role="paragraph" id="par_id621542232197446" xml-lang="en-US"><emph>Text</emph>: A text or reference to a cell where the regular expression is to be applied.</paragraph>
-    <paragraph role="paragraph" id="par_id211542232209275" xml-lang="en-US"><emph>Expression</emph>: A text representing the regular expression, using <link href="https://userguide.icu-project.org/strings/regexp" name="ICU REGEXP">ICU regular expressions</link>. If there is no match, #N/A is returned.</paragraph>
+    <paragraph role="paragraph" id="par_id211542232209275" xml-lang="en-US"><emph>Expression</emph>: A text representing the regular expression, using <link href="https://userguide.icu-project.org/strings/regexp" name="ICU REGEXP">ICU regular expressions</link>. If there is no match and <emph>Replacement</emph> is not given, #N/A is returned.</paragraph>
     <paragraph role="paragraph" id="par_id581542232755604" xml-lang="en-US"><emph>Replacement</emph>: Optional. The replacement text and references to capture groups. If there is no match, <emph>Text</emph> is returned unmodified.</paragraph>
     <paragraph role="paragraph" id="par_id421542232246840" xml-lang="en-US"><emph>Flags</emph>: Optional. "g" replaces all matches of <emph>Expression</emph> in <emph>Text</emph>, not extracted. If there is no match, <emph>Text</emph> is returned unmodified.</paragraph>
+    <paragraph role="paragraph" id="par_id421542232246841" xml-lang="en-US"><emph>Occurrence</emph>: Optional. Number to indicate which match of <emph>Expression</emph> in <emph>Text</emph> is to be extracted or replaced. If there is no match and <emph>Replacement</emph> is not given, #N/A is returned. If there is no match and <emph>Replacement</emph> is given, <emph>Text</emph> is returned unmodified. If <emph>Occurrence</emph> is 0, <emph>Text</emph> is returned unmodified.</paragraph>
     <embed href="text/scalc/01/ful_func.xhp#func_head_example"/>
     <paragraph role="paragraph" id="par_id371542291684176" xml-lang="en-US"><item type="input">=REGEX("123456ABCDEF";"[:digit:]";"Z")</item>  returns "Z23456ABCDEF", where the first match of a digit is replaced by "Z".</paragraph>
     <paragraph role="paragraph" id="par_id891542291697194" xml-lang="en-US"><item type="input">=REGEX("123456ABCDEF";"[:digit:]";"Z";"g")</item>  returns "ZZZZZZABCDEF", where all digits were replaced by "Z".</paragraph>
-    <paragraph role="paragraph" id="par_id21542291705695" xml-lang="en-US"><item type="input">=REGEX("123456ABCDEF";"[1|2|6]";"";"g")</item>  returns "345ABCDEF", where any occurrence of "1", "2" or "6" is replaced by the empty string, thus deleted. </paragraph>
+    <paragraph role="paragraph" id="par_id21542291705695" xml-lang="en-US"><item type="input">=REGEX("123456ABCDEF";"[126]";"";"g")</item>  returns "345ABCDEF", where any occurrence of "1", "2" or "6" is replaced by the empty string, thus deleted. </paragraph>
+    <paragraph role="paragraph" id="par_id371542291684177" xml-lang="en-US"><item type="input">=REGEX("axbxcxd";".x";;2)</item>  returns "bx", the second match of ".x".</paragraph>
+    <paragraph role="paragraph" id="par_id371542291684178" xml-lang="en-US"><item type="input">=REGEX("axbxcxd";"(.)x";"$1y";2)</item>  returns "axbycxd", the second match of "(.)x" (i.e. "bx") replaced with the captured group of one character (i.e. "b") followed by "y".</paragraph>
     <section id="relatedtopics">
         <paragraph role="paragraph" id="par_id711542233602553" xml-lang="en-US"><link href="text/shared/01/02100001.xhp" name="regex lists">List of regular expressions</link></paragraph>
         <paragraph role="paragraph" id="par_id431542233650614" xml-lang="en-US"><link href="https://userguide.icu-project.org/strings/regexp" name="ICU REGEXP">ICU regular expressions</link></paragraph>


More information about the Libreoffice-commits mailing list