<aside> <img src="https://s3-us-west-2.amazonaws.com/secure.notion-static.com/5f290176-d74d-4847-824b-f173f3489a87/tfexplains-profile.jpg" alt="https://s3-us-west-2.amazonaws.com/secure.notion-static.com/5f290176-d74d-4847-824b-f173f3489a87/tfexplains-profile.jpg" width="40px" /> This page contains working examples for all supported quantifiers in Notion regular expressions. Duplicate this page to your workspace if youβre unable to view the formulas.
Regular Expressions in Notion Formulas
Created by Thomas Frank | Learn Notion Formulas | Notion Basics | Templates | Twitter
</aside>
π References:
Unicode Numbers in Regular Expressions
π Table of Contents:
*
- match zero or more of the preceding characterreplaceAll("Trs Tres Trees Treeeeees", "Tre*s", "π³")
// Output: π³ π³ π³ π³
replaceAll("Trs Tres Trees Treees Treeees", "Tr(ee)*s", "π³")
// Output: π³ Tres π³ Treees π³
+
- match one or more of the preceding characterreplaceAll("Trs Tres Trees Treeeeees", "Tre+s", "π³")
// Output: Trs π³ π³ π³
replaceAll("Trs Tres Trees Treees Treeees", "Tr(ee)+s", "π³")
// Output: Trs Tres π³ Treees π³
?
- preceding character is optional; match zero or one of itreplaceAll("Trs Tres Trees Treeeeees", "Tre?s", "π³")
// Output: π³ π³ Trees Treeeeees
replaceAll("Trs Tres Trees Treees Treeees","Tr(ee)?s","π³")
// Output: π³ Tres π³ Treees Treeees
??
- match preceding character zero or one times (as few times as possible)replaceAll("Trs Tres Trees Treees Treeees", "Tre??s", "π³")
// Output: π³ π³ Trees Treees Treeees
replaceAll("Trs Tres Trees Treees Treeees", "Tr(ee)??s", "π³")
// Output: π³ Tres π³ Treees Treeees
+?
- match preceding character one or more times (as few times as possible)replace("Tree", "Tre+?", "π³")
// Output: π³e
*?
- match preceding character zero or more times (as few times as possible)replace("Heeeeeeelp", "H.*?", "*")
// Output: *eeeeeeelp
replace("Heeeeeeelp", "H.*?l", "*")
// Output: *p
{n}
- match the preceding character n timesreplace("Heeeeeeelp", "e{7}", "*")
// Output: H*lp
{n,}
- match the preceding character n or more timesreplace("Heeeeeeelp", "e{1,}", "*")
// Output: H*lp
{n,m}
- match the preceding character between n and m times (inclusive)replace("Heeeeeeelp", "e{1,6}", "*")
// Output: H*elp
{n}?
- match the preceding character n times (no difference from {n}
replace("Heeeeeeelp", "e{1,}?", "*")
// Output: H*eeeeeelp
{n,}?
- match the preceding character at least n times, but as few times as possiblereplace("Heeeeeeelp", "e{1,}?", "*")
// Output: H*eeeeeelp
{n,m}?
- match the preceding character at least n times, no more than m times, and as few times as possiblereplace("Heeeeeeelp", "e{1,6}?", "*")
// Output: H*eeeeeelp
Β© Thomas Frank