# Allow spaces in curly brackets in RegularExpressions

**URL:** https://es.discourse.group/t/allow-spaces-in-curly-brackets-in-regularexpressions/296
**Category:** 💡 Ideas
**Created:** [April 7, 2020, 12:28pm UTC](https://es.discourse.group/t/allow-spaces-in-curly-brackets-in-regularexpressions/296 "2020-04-07T12:28:57Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![jaroslav.tavgen](https://yyz2.discourse-cdn.com/free1/user_avatar/es.discourse.group/jaroslav.tavgen/32/2732_2.png) [@jaroslav.tavgen](https://es.discourse.group/u/jaroslav.tavgen)
#### Post date: [April 7, 2020, 12:28pm UTC](https://es.discourse.group/t/allow-spaces-in-curly-brackets-in-regularexpressions/296/1 "2020-04-07T12:28:57Z")

</div>

"aaab".match(/a{1, 2}/g) currently gives the result "null". Because there is a space after comma. While "aaab".match(/a{1,2}/g) will work just fine (["aa", "a"]).

My proposal: spaces after commas should be ignored in regular expressions and "aaab".match(/a{1, 2}/g) or "aaab".match(/a{1, 2}/g) should provide the result ["aa", "a"].

Setting spaces after commas is often recommended and encouraged both in code and in common texts. IMO, it would be logical to invoke that in regular expressions as well.

---

<div class="post-metadata">

### Author: ![bergus](https://yyz2.discourse-cdn.com/free1/user_avatar/es.discourse.group/bergus/32/152_2.png) [@bergus](https://es.discourse.group/u/bergus)
#### Post date: [April 7, 2020, 12:52pm UTC](https://es.discourse.group/t/allow-spaces-in-curly-brackets-in-regularexpressions/296/2 "2020-04-07T12:52:12Z")

</div>

Hi!  
This feature is known as [free-spacing](https://www.regular-expressions.info/freespacing.html). Have a look at [this old es-discuss thread](https://esdiscuss.org/topic/regexp-free-spacing-comments), and someone already put together a [`/x` flag proposal](https://github.com/motiz88/proposal-regexp-freespacing-flag).
