# Yang regex spaces

**URL:** <https://dmap-community.ductus.global/t/yang-regex-spaces/2799>\
**Category:** YANG\
**Created:** [November 20, 2019, 10:05pm UTC](https://dmap-community.ductus.global/t/yang-regex-spaces/2799 "2019-11-20T22:05:35Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![shrey](https://avatars.discourse-cdn.com/v4/letter/s/b5a626/32.png) [@shrey](https://dmap-community.ductus.global/u/shrey)\
**Post date:** [November 20, 2019, 10:05pm UTC](https://dmap-community.ductus.global/t/yang-regex-spaces/2799/1 "2019-11-20T22:05:35Z")

</div>

What is the regex pattern to match a whitespace in YANG?

---

<div class="post-metadata">

**Author:** ![per](https://avatars.discourse-cdn.com/v4/letter/p/9f8e36/32.png) [@per](https://dmap-community.ductus.global/u/per)\
**Post date:** [November 21, 2019, 12:50pm UTC](https://dmap-community.ductus.global/t/yang-regex-spaces/2799/2 "2019-11-21T12:50:31Z")

</div>

Assuming that you are talking about the ‘pattern’ statement, per the specification at [XML Schema Part 2: Datatypes Second Edition](https://www.w3.org/TR/2004/REC-xmlschema-2-20041028/#regexs), `\s` is equivalent to the character class `[#x20\t\n\r]` (i.e. ascii space, tab, newline, carriage return) - i.e. the same as in Perl regexps, I believe. Whether you really want to allow all of those in your leaf values is perhaps worth consideration - if you only want to allow the space character, it can be matched by - a space character!🙂
