contains()gets the first one right, but fails on the other two.
\\b[Cc]ats?\\b. Let’s break it down:
\\bis a special character that translates to “word boundary”. It’s not a space character; it’s the boundary between a word character and a non-word character. In Notion, word characters include
[Cc]is a character class. The brackets
define a group of characters (
c), and the regex engine will try to match any one of them. This allows us to check for both “Cat” and “cat”.
?denotes that the preceding character is optional. It can appear zero or one times in the match. Since the
sprecedes it, this allows us to include the plural “cats” as well as the singular “cat”.
Match any of the words “Cat, cat, Cats, or cats”.
contains()would be really inefficient. You’d need to string together many, many
contains()instances using or clauses in order to account for the many variables – not just plurality and capitalization, but word boundaries as well!
\u0041), but they will be automatically converted to their corresponding character in the formula editor upon exiting it.
\nis used in the input string and replacement arguments, but
\\nmust be used in the regular expression.
A-Z(all uppercase character),
A-z(all upper and lowercase characters), and
(?(expression) yes | no)
\\to escape the Unicode reference:
\, it’ll automatically be transformed into that character – within the formula itself (this does not work for hex and octal codes).
"in a Notion formula using a single backslash
\\u0022for a normal quotation mark
\\u201cfor a left double quotation mark
\\u201dfor a right double quotation mark
Mike "Iron Mike" Tyson:
"– however, when you type within text fields inside a Notion database, Notion intelligently uses left
”quotation marks to wrap your text.
Mike \"Iron Mike\" Tysonwithin the formula editor. However, if that string had been pulled in via another property (e.g.
prop("Name")), then it would likely be using left