Hello,
Regular expressions are a shorthand way of specifying strings against
which to match an input. In the COUNTIF(), MATCH(), VLOOKUP(), etc.
functions, when you provide a regular expression, you are asking to
compare your input to a summary version of what you are looking for.
For example, the expression "[hH]ello" means that you are looking for
the word "hello" that could begin with either an uppercase or lowercase
letter. The way to write the shorthand depends on the application you
are using. Though many applications support regular expressions, some
support all, a subset, or extensions to the basic regular expression
syntax. The document you found seems to be a good description of what
LO supports.

Now, for your question in particular. The COUNTIF() function wants, as
part of its syntax, that comparing the input to your match string
produces a TRUE/FALSE result, like in the IF() function. This is
different from MATCH() or VLOOKUP() where the objective is to obtain a
full or partial match. To allow you to make this happen, COUNTIF()
requires the use of comparison operators (=, <, <=, >, >=, <>) when a
test is made with a non-boolean (TRUE/FALSE) value. Those operators are
not part of the expression: they are there to tell COUNTIF() how to
compare the input with your expected value. If you place the function
=COUNTIF(A1:A1,"<>[Hh]ello") in cell B1, would be exactly the same as
putting =IF(AND(A1<>"Hello",A1<>"hello"),1,0) in B1. In this case, the
expression is [Hh]ello, and the comparison operator is <>.

I hope this helps.
Rémy.

Le vendredi 09 juillet 2021 à 11:39 +0100, Dave Howorth a écrit :
> On Thu, 8 Jul 2021 22:38:49 +0100
> David Lynch <dlynch131...@gmail.com> wrote:
> 
> > The documentation 
> > <
> > file:///C:/Program%20Files/LibreOffice/help/en-GB/text/scalc/01/04060181.html?DbPAR=CALC#bm_id3164897
> > >
> > for COUNTIF gives the following examples, among others:
> > 
> > =COUNTIF(A1:A10;">=2006")  
> > =COUNTIF(A1:A10;"<"&B1)
> > =COUNTIF(A1:A10;C2)
> > =COUNTIF(A1:A10;"<0")
> >   and these do indeed work.
> > 
> >   However the list of regular expressions linked from the COUNTIF
> > page
> > <
> > file:///C:/Program%20Files/LibreOffice/help/en-GB/text/shared/01/02100001.html?&DbPAR=CALC&System=WIN
> > >
> > does not include the use of > and < as operators.
> > 
> > Neither does the "full list of supported metacharacters and syntax"
> > <https://unicode-org.github.io/icu/userguide/strings/regexp.html>
> > linked from the help page in the previous paragraph.
> > 
> > Neither does the page
> > <http://userguide.icu-project.org/strings/regexp> linked from the
> > REGEX help page
> > <
> > file:///C:/Program%20Files/LibreOffice/help/en-GB/text/scalc/01/func_regex.html?DbPAR=CALC#bm_id831542233029549
> > >
> > 
> > Please, is there anywhere that tells me what regular expressions
> > are 
> > supported?
> > 
> > David Lynch
> > 
> > Version: 7.1.4.2 (x64) / LibreOffice Community
> > Build ID: a529a4fab45b75fefc5b6226684193eb000654f6
> > CPU threads: 4; OS: Windows 10.0 Build 19041; UI render:
> > Skia/Raster; 
> > VCL: win
> > Locale: en-GB (en_GB); UI: en-GB
> > Calc: threaded
> 
> I don't believe that '>'and '<' used as operators are regular
> expressions. They are parts of more general 'criteria', which the
> documentation
> <
> https://wiki.documentfoundation.org/Documentation/Calc_Functions/COUNTIF
> >
> implies are 'wild cards'. But searching the documentation doesn't
> reveal
> any definition or even explanation of what a wild card is :(
> 
> So I think the answer to your question is that the definition of
> regexes supported is indeed
> <https://unicode-org.github.io/icu/userguide/strings/regexp.html> but
> that the particular criterion you are interested in is not a regex
> and
> thus not documented there. Perhaps somebody else knows where such
> criteria ARE documented?
> 


-- 
To unsubscribe e-mail to: users+unsubscr...@global.libreoffice.org
Problems? https://www.libreoffice.org/get-help/mailing-lists/how-to-unsubscribe/
Posting guidelines + more: https://wiki.documentfoundation.org/Netiquette
List archive: https://listarchives.libreoffice.org/global/users/
Privacy Policy: https://www.documentfoundation.org/privacy

Reply via email to