<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)