diff options
author | Rafael Lima <rafael.palma.lima@gmail.com> | 2021-08-17 01:53:52 +0200 |
---|---|---|
committer | Mike Kaganski <mike.kaganski@collabora.com> | 2021-08-18 15:08:55 +0200 |
commit | d42ad54f4c9c1b07ca851ce76ceb77f512c4f1ba (patch) | |
tree | 095a6553b9823df09b1cf360c696069f048930d8 /source | |
parent | e4f55790b32ad295322c712ed49d0349f4eea66d (diff) |
tdf#142574 Create help page on "wildcards"
This patch creates the wildcards.xhp help page and makes the required adaptations in tree files to disambiguate "wildcards" and "regular expressions" in the help system.
Change-Id: I82f1e192b6bf9e605fc3cfde50b648ce902cefdb
Reviewed-on: https://gerrit.libreoffice.org/c/help/+/120573
Tested-by: Jenkins
Reviewed-by: Steve Fanning <stevemfanning@yahoo.co.uk>
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Diffstat (limited to 'source')
-rw-r--r-- | source/auxiliary/scalc.tree | 1 | ||||
-rw-r--r-- | source/auxiliary/swriter.tree | 2 | ||||
-rw-r--r-- | source/text/scalc/guide/wildcards.xhp | 93 | ||||
-rw-r--r-- | source/text/swriter/guide/search_regexp.xhp | 122 |
4 files changed, 155 insertions, 63 deletions
diff --git a/source/auxiliary/scalc.tree b/source/auxiliary/scalc.tree index 96af43ee37..9d5f986af9 100644 --- a/source/auxiliary/scalc.tree +++ b/source/auxiliary/scalc.tree @@ -182,6 +182,7 @@ <topic id="scalc/text/scalc/guide/calc_series.xhp">Automatically Calculating Series</topic> <topic id="scalc/text/scalc/guide/calc_timevalues.xhp">Calculating Time Differences</topic> <topic id="scalc/text/scalc/guide/matrixformula.xhp">Entering Matrix Formulas</topic> +<topic id="scalc/text/scalc/guide/wildcards.xhp">Using Wildcards in Formulas</topic> </node> <node id="0814" title="Protection"> <topic id="scalc/text/scalc/guide/cell_protect.xhp">Protecting Cells from Changes</topic> diff --git a/source/auxiliary/swriter.tree b/source/auxiliary/swriter.tree index 686960031e..a4a8894dff 100644 --- a/source/auxiliary/swriter.tree +++ b/source/auxiliary/swriter.tree @@ -226,7 +226,7 @@ <topic id="swriter/text/swriter/guide/pagestyles.xhp">Creating and Applying Page Styles</topic> </node> <node id="0223" title="Searching and Replacing"> -<topic id="swriter/text/swriter/guide/search_regexp.xhp">Using Wildcards in Text Searches</topic> +<topic id="swriter/text/swriter/guide/search_regexp.xhp">Using Regular Expressions in Text Searches</topic> <topic id="shared/text/shared/01/02100001.xhp">List of Regular Expressions</topic> </node> </help_section> diff --git a/source/text/scalc/guide/wildcards.xhp b/source/text/scalc/guide/wildcards.xhp new file mode 100644 index 0000000000..063102c0a6 --- /dev/null +++ b/source/text/scalc/guide/wildcards.xhp @@ -0,0 +1,93 @@ +<?xml version="1.0" encoding="UTF-8"?> +<helpdocument version="1.0"> +<!-- + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + --> + +<meta> + <topic id="calc_wildcards" indexer="include" status="PUBLISH"> + <title xml-lang="en-US" id="tit">Using Wildcards in Formulas</title> + <filename>/text/scalc/guide/wildcards.xhp</filename> + </topic> +</meta> + +<body> + <bookmark xml-lang="en-US" branch="index" id="bm_id3152149"> + <bookmark_value>wildcards in calc formulas</bookmark_value> + <bookmark_value>wildcards, examples</bookmark_value> + </bookmark> + <h1 id="hd_id941629155075179"><variable id="wildcards_h1"><link href="text/scalc/guide/wildcards.xhp" name="wildcards_link">Using Wildcards in Formulas</link></variable></h1> + <paragraph role="paragraph" id="par_id571629155308959">Wildcards are special characters that can be used in search strings that are passed as arguments to some Calc functions. They can also be used to define search criteria in the <emph>Find & Replace</emph> dialog. The use of wildcards enables the definition of more advanced search parameters with a single search string.</paragraph> + <paragraph role="paragraph" id="par_id391629156224638">%PRODUCTNAME Calc supports either <emph>wildcards</emph> or <emph>regular expressions</emph> as arguments depending on the current application settings. By default %PRODUCTNAME Calc is set to support wildcards instead of regular expressions.</paragraph> + <tip id="par_id551629156504794">To make sure wildcards are supported, go to <switchinline select="sys"><caseinline select="MAC"><menuitem>LibreOffice - Preferences - %PRODUCTNAME Calc - Calculate</menuitem></caseinline><defaultinline><menuitem>Tools - Options - %PRODUCTNAME Calc - Calculate</menuitem></defaultinline></switchinline> and check if the option <emph>Enable wildcards in formulas</emph> is selected. Note that you can use this dialog to switch to regular expressions by choosing <emph>Enable regular expressions in formulas</emph> or choose to support neither wildcards nor regular expressions.</tip> + <paragraph role="paragraph" id="par_id141629156913731">The following wildcards are supported:</paragraph> + <table id="tab_id561629209073388"> + <tablerow> + <tablecell> + <paragraph id="par_id801629209195110" role="tablehead">Wildcard</paragraph> + </tablecell> + <tablecell> + <paragraph id="par_id861629209212608" role="tablehead">Description</paragraph> + </tablecell> + </tablerow> + <tablerow> + <tablecell> + <paragraph id="par_id591629209073388" role="tablecontent"><emph>? (question mark)</emph></paragraph> + </tablecell> + <tablecell> + <paragraph id="par_id31629209073388" role="tablecontent">Matches any single character. For example, the search string "b?g" matches “bag” and “beg” but will not match "boog" or "mug".</paragraph> + <paragraph id="par_id121629209114452" role="tablecontent">Note that it will not match "bg" as well, since "?" must match exactly <emph>one</emph> character. The "?" wildcard does not correspond to a zero-character match.</paragraph> + </tablecell> + </tablerow> + <tablerow> + <tablecell> + <paragraph id="par_id981629209073388" role="tablecontent"><emph>* (asterisk)</emph></paragraph> + </tablecell> + <tablecell> + <paragraph id="par_id51629209073388" role="tablecontent">Matches any sequence of characters, including an empty string. For example, the search string "*cast" will match “cast”, “forecast”, and “outcast”, but will not match "forecaster" using default %PRODUCTNAME settings.</paragraph> + <paragraph id="par_id351629209153307" role="tablecontent">If the option <menuitem>Search criteria = and <> must apply to whole cells</menuitem> is disabled in <switchinline select="sys"><caseinline select="MAC"><menuitem>LibreOffice - Preferences - %PRODUCTNAME Calc - Calculate</menuitem></caseinline><defaultinline><menuitem>Tools - Options - %PRODUCTNAME Calc - Calculate</menuitem></defaultinline></switchinline>, then "forecaster" will be a match using the "*cast" search string.</paragraph> + </tablecell> + </tablerow> + <tablerow> + <tablecell> + <paragraph id="par_id181629209277556" role="tablecontent"><emph>~ (tilde)</emph></paragraph> + </tablecell> + <tablecell> + <paragraph id="par_id881629209280877" role="tablecontent">Escapes the special meaning of a question mark, asterisk, or tilde character that follows immediately after the tilde character.</paragraph> + <paragraph id="par_id861629209431020" role="tablecontent">For example, the search string "why~?" matches “why?” but will not match "whys" nor "why~s".</paragraph> + </tablecell> + </tablerow> + </table> + <tip id="par_id1001629157561261">Wildcards are supported in %PRODUCTNAME Calc and in Microsoft Excel. Therefore, if interoperability between both applications is needed, choose to work with wildcards instead of regular expressions. Conversely, if interoperability is not necessary, consider using regular expressions for more powerful search capabilities.</tip> + <h2 id="hd_id671629158766165">Supported Spreadsheet Functions</h2> + <paragraph role="paragraph" id="par_id161629158785887">Wildcards are supported by the following spreadsheet functions:</paragraph> + <list type="unordered"> + <listitem> + <paragraph id="par_id441629158810517" role="listitem"><emph>Database functions:</emph> DAVERAGE, DCOUNT, DCOUNTA, DGET, DMAX, DMIN, DPRODUCT, DSTDEV, DSTDEVP, DSUM, DVAR and DVARP.</paragraph> + </listitem> + <listitem> + <paragraph id="par_id321629158810916" role="listitem"><emph>Conditional functions:</emph> AVERAGEIF, AVERAGEIFS, COUNTIF, COUNTIFS, MAXIFS, MINIFS, SUMIF and SUMIFS.</paragraph> + </listitem> + <listitem> + <paragraph id="par_id941629158811325" role="listitem"><emph>Lookup functions:</emph> HLOOKUP, LOOKUP and VLOOKUP.</paragraph> + </listitem> + <listitem> + <paragraph id="par_id41629158919808" role="listitem"><emph>Other functions:</emph> MATCH and SEARCH.</paragraph> + </listitem> + </list> + <h2 id="hd_id701629159564269">Examples of Wildcards in Formulas</h2> + <paragraph role="paragraph" id="par_id121629289062103">The following examples consider that the options <menuitem>Enable wildcards in formulas</menuitem> and <menuitem>Search criteria = and <> must apply to whole cells</menuitem> are enabled in <switchinline select="sys"><caseinline select="MAC"><menuitem>LibreOffice - Preferences - %PRODUCTNAME Calc - Calculate</menuitem></caseinline><defaultinline><menuitem>Tools - Options - %PRODUCTNAME Calc - Calculate</menuitem></defaultinline></switchinline>.</paragraph> + <paragraph role="paragraph" id="par_id271629159111490"><input>=COUNTIF(A1:A10;"Chi*")</input> counts the number of cells in the range <emph>A1:A10</emph> containing strings that start with "Chi" followed by zero or more characters.</paragraph> + <paragraph role="paragraph" id="par_id741629159343415"><input>=SUMIF(A1:A5;"A??";B1:B5)</input> sums the values in <emph>B1:B5</emph> whose corresponding values in <emph>A1:A5</emph> start with "A" followed by exactly two other characters.</paragraph> + <note id="par_id141629159465592">Wildcard comparisons are <emph>not</emph> case sensitive, hence "A?" will match both "A1" and "a1".</note> + + <section id="relatedtopics"> + <embed href="text/shared/01/02100001.xhp#02100001"/> + </section> +</body> +</helpdocument> diff --git a/source/text/swriter/guide/search_regexp.xhp b/source/text/swriter/guide/search_regexp.xhp index c0f4553765..ef209ff8ec 100644 --- a/source/text/swriter/guide/search_regexp.xhp +++ b/source/text/swriter/guide/search_regexp.xhp @@ -1,6 +1,5 @@ <?xml version="1.0" encoding="UTF-8"?> <helpdocument version="1.0"> - <!-- * This file is part of the LibreOffice project. * @@ -19,66 +18,65 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . --> - <meta> - <topic id="textswriterguidesearch_regexpxml" indexer="include" status="PUBLISH"> - <title xml-lang="en-US" id="tit">Using Regular Expressions in Text Searches</title> - <filename>/text/swriter/guide/search_regexp.xhp</filename> - </topic> - </meta> - <body> -<bookmark xml-lang="en-US" branch="index" id="bm_id3150099"> -<bookmark_value>wildcards, see regular expressions</bookmark_value> -<bookmark_value>searching; with regular expressions</bookmark_value> -<bookmark_value>regular expressions;searching</bookmark_value> -<bookmark_value>examples for regular expressions</bookmark_value> -<bookmark_value>characters;finding all</bookmark_value> -<bookmark_value>invisible characters;finding</bookmark_value> -<bookmark_value>paragraph marks;searching</bookmark_value> -</bookmark><comment>mw deleted "wildcards;" and inserted wildcards crossreference</comment><comment>mw added "paragraph marks;"</comment> -<paragraph xml-lang="en-US" id="hd_id3150099" role="heading" level="1"><variable id="search_regexp"><link href="text/swriter/guide/search_regexp.xhp">Using Regular Expressions in Text Searches</link> -</variable></paragraph> - <paragraph xml-lang="en-US" id="par_id0509200916345516" role="paragraph">Regular expressions can be used to search for some unspecified or even invisible characters.</paragraph> - <note id="par_id421554926388821">Searching with regular expressions is different from searching with wildcards. %PRODUCTNAME Writer only supports searching with regular expressions.</note> - <paragraph xml-lang="en-US" id="par_id3155182" role="paragraph">You can use regular expressions when you find and replace text in a document. For example, "s.n" finds "sun" and "son".</paragraph> - <list type="ordered"> - <listitem> - <paragraph xml-lang="en-US" id="par_id3155907" role="listitem">Choose <item type="menuitem">Edit - Find & Replace</item>.</paragraph> - </listitem> - <listitem> - <paragraph xml-lang="en-US" id="par_id2142399" role="listitem">Click <item type="menuitem">More Options</item> to expand the dialog.</paragraph> - </listitem> - <listitem> - <paragraph xml-lang="en-US" id="par_id3155861" role="listitem">Select the <item type="menuitem">Regular expressions</item> check box.</paragraph> - </listitem> - <listitem> - <paragraph xml-lang="en-US" id="par_id3149843" role="listitem">In the <item type="menuitem">Find</item> box, type the search term and the regular expression(s) that you want to use in your search.</paragraph> - </listitem> - <listitem> - <paragraph xml-lang="en-US" id="par_id3156113" role="listitem">Click <item type="menuitem">Find Next</item> or <item type="menuitem">Find All</item>.</paragraph> - </listitem> - </list> - <paragraph xml-lang="en-US" id="hd_id3153401" role="heading" level="2">Regular Expression Examples</paragraph> - <list type="ordered"> - <listitem> - <paragraph xml-lang="en-US" id="par_id3149641" role="listitem">The regular expression for a single character is a period (.).</paragraph> - </listitem> - <listitem> - <paragraph xml-lang="en-US" id="par_id3153136" role="listitem">The regular expression for zero or more occurrences of the previous character is an asterisk. For example: "123*" finds "12" "123", and "1233".</paragraph> - </listitem> - <listitem> - <paragraph xml-lang="en-US" id="par_id3149609" role="listitem">The regular expression combination to search for zero or more occurrences of any character is a period and asterisk (.*).</paragraph> - </listitem> - <listitem> - <paragraph xml-lang="en-US" id="par_id3149854" role="listitem">The regular expression for the end of a paragraph is a dollar sign ($). The regular expression character combination for the start of a paragraph is a caret and a period (^.).</paragraph> - </listitem> - <listitem> - <paragraph xml-lang="en-US" id="par_id0509200916345545" role="listitem">The regular expression for a tab character is \t.</paragraph> - </listitem> - </list> - <paragraph xml-lang="en-US" id="par_id3153414" role="note">A search using a regular expression will work only within one paragraph. To search using a regular expression in more than one paragraph, do a separate search in each paragraph.</paragraph> - <section id="relatedtopics"> - <paragraph xml-lang="en-US" id="par_id3149875" role="paragraph"><link href="text/shared/01/02100001.xhp" name="List of regular expressions">List of regular expressions</link></paragraph> - </section> - </body> + <topic id="textswriterguidesearch_regexpxml" indexer="include" status="PUBLISH"> + <title xml-lang="en-US" id="tit">Using Regular Expressions in Text Searches</title> + <filename>/text/swriter/guide/search_regexp.xhp</filename> + </topic> +</meta> + +<body> + <bookmark xml-lang="en-US" branch="index" id="bm_id3150099"> + <bookmark_value>searching; with regular expressions</bookmark_value> + <bookmark_value>regular expressions;searching</bookmark_value> + <bookmark_value>examples for regular expressions</bookmark_value> + <bookmark_value>characters;finding all</bookmark_value> + <bookmark_value>invisible characters;finding</bookmark_value> + <bookmark_value>paragraph marks;searching</bookmark_value> + </bookmark> + <paragraph xml-lang="en-US" id="hd_id3150099" role="heading" level="1"><variable id="search_regexp"><link href="text/swriter/guide/search_regexp.xhp">Using Regular Expressions in Text Searches</link></variable></paragraph> + <paragraph xml-lang="en-US" id="par_id0509200916345516" role="paragraph">Regular expressions can be used to search for some unspecified or even invisible characters.</paragraph> + <note id="par_id421554926388821">Searching with regular expressions is different from searching with wildcards. %PRODUCTNAME Writer only supports searching with regular expressions.</note> + <paragraph xml-lang="en-US" id="par_id3155182" role="paragraph">You can use regular expressions when you find and replace text in a document. For example, "s.n" finds "sun" and "son".</paragraph> + <list type="ordered"> + <listitem> + <paragraph xml-lang="en-US" id="par_id3155907" role="listitem">Choose <item type="menuitem">Edit - Find & Replace</item>.</paragraph> + </listitem> + <listitem> + <paragraph xml-lang="en-US" id="par_id2142399" role="listitem">Click <item type="menuitem">More Options</item> to expand the dialog.</paragraph> + </listitem> + <listitem> + <paragraph xml-lang="en-US" id="par_id3155861" role="listitem">Select the <item type="menuitem">Regular expressions</item> check box.</paragraph> + </listitem> + <listitem> + <paragraph xml-lang="en-US" id="par_id3149843" role="listitem">In the <item type="menuitem">Find</item> box, type the search term and the regular expression(s) that you want to use in your search.</paragraph> + </listitem> + <listitem> + <paragraph xml-lang="en-US" id="par_id3156113" role="listitem">Click <item type="menuitem">Find Next</item> or <item type="menuitem">Find All</item>.</paragraph> + </listitem> + </list> + <paragraph xml-lang="en-US" id="hd_id3153401" role="heading" level="2">Regular Expression Examples</paragraph> + <list type="ordered"> + <listitem> + <paragraph xml-lang="en-US" id="par_id3149641" role="listitem">The regular expression for a single character is a period (.).</paragraph> + </listitem> + <listitem> + <paragraph xml-lang="en-US" id="par_id3153136" role="listitem">The regular expression for zero or more occurrences of the previous character is an asterisk. For example: "123*" finds "12" "123", and "1233".</paragraph> + </listitem> + <listitem> + <paragraph xml-lang="en-US" id="par_id3149609" role="listitem">The regular expression combination to search for zero or more occurrences of any character is a period and asterisk (.*).</paragraph> + </listitem> + <listitem> + <paragraph xml-lang="en-US" id="par_id3149854" role="listitem">The regular expression for the end of a paragraph is a dollar sign ($). The regular expression character combination for the start of a paragraph is a caret and a period (^.).</paragraph> + </listitem> + <listitem> + <paragraph xml-lang="en-US" id="par_id0509200916345545" role="listitem">The regular expression for a tab character is \t.</paragraph> + </listitem> + </list> + <paragraph xml-lang="en-US" id="par_id3153414" role="note">A search using a regular expression will work only within one paragraph. To search using a regular expression in more than one paragraph, do a separate search in each paragraph.</paragraph> + <section id="relatedtopics"> + <embed href="text/shared/01/02100001.xhp#02100001"/> + <embed href="text/scalc/guide/wildcards.xhp#wildcards_h1"/> + </section> +</body> </helpdocument> |