Regular Expressions 101
This is a topic that you will best learn by trying out stuff for yourself - but here I summarize the basics…
There are a number of builtin functions that make use of regular expressions. Here, we use COUNTIF to illustrate some of the possibilities.
Regular expressions are a system for matching patterns in strings. They provide a very powerful set of tools for finding particular words or combinations of characters.
Based on my investigation, the following is a summary of the allowable constructs in OOo Calc.
-
Most characters match themselves. There are exceptions - see below.
COUNTIF(A1:A100; “foo”) will return all the instances of the string “foo” in the specified range. -
“.” matches any single character.
COUNTIF(B2:B18; “..”) counts all cells with exactly two characters. -
“*” is a special character that matches zero or more occurences of the previous expression.
COUNTIF(B2:B18; “.*e”) counts all cells that end in “e”. -
“+” is a special character that matches one or more occurences of the previous single character.
COUNTIF(B2:B18; “.+m.+”) includes “Tmmy” and “name”, but not “my”. -
A string of characters enclosed in square brackets ([]) matches any one character in that string.
COUNTIF(B2:B18; “[efg].*”) counts all cells starting with e, f, or g.

October 15th, 2007 at 1:20 pm
I want to do a count on recurring text, without having to enter the text directly. For example, I have a column of text. Some text is unique while others are recurring. I want to pull from that row, each unique text item, and the number of times that it appears in the list. An example would be:
Albert
Bob
Carl
Bob
Dave
Bob
Carl
Dave
Dave
Is there a command to identify each unique item in this row, and then count that item, without having to manually write to look for Albert, Bob, Carl and Dave?
Using COUNTIF, it appears that the user is required to search for the unique items, and add them to the expression. Does OO have the ability to search for and count text items?
November 2nd, 2007 at 9:12 pm
You can get these counts from OO-Calc / Data / DataPilot, which can produce a table of user-selected counts and sums from a specified worksheet data range. Like PivotTable in Excel. But your question doesn’t relate to regular expressions.
November 29th, 2007 at 8:35 am
Hi, my name is disman-kl, i like your site and i ll be back