# How to use "\\" in pattern?

**URL:** <https://dmap-community.ductus.global/t/how-to-use-in-pattern/3568>\
**Category:** YANG\
**Created:** [March 22, 2021, 10:24am UTC](https://dmap-community.ductus.global/t/how-to-use-in-pattern/3568 "2021-03-22T10:24:51Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![sushil](https://avatars.discourse-cdn.com/v4/letter/s/e19adc/32.png) [@sushil](https://dmap-community.ductus.global/u/sushil)\
**Post date:** [March 22, 2021, 10:24am UTC](https://dmap-community.ductus.global/t/how-to-use-in-pattern/3568/1 "2021-03-22T10:24:51Z")

</div>

When i am use ascii value of "\ "or escape sequence like “\” then it is showing error :-bad pattern.  
How to solve this issue?

---

<div class="post-metadata">

**Author:** ![cohult](https://yyz2.discourse-cdn.com/flex010/user_avatar/dmap-community.ductus.global/cohult/32/221_2.png) [@cohult](https://dmap-community.ductus.global/u/cohult)\
**Post date:** [March 22, 2021, 11:18am UTC](https://dmap-community.ductus.global/t/how-to-use-in-pattern/3568/2 "2021-03-22T11:18:53Z")

</div>

The YANG RFC [https://tools.ietf.org/html/rfc7950#section-9.4.5](https://tools.ietf.org/html/rfc7950#section-9.4.5) point to [https://www.w3.org/TR/2004/REC-xmlschema-2-20041028/#regexs](https://www.w3.org/TR/2004/REC-xmlschema-2-20041028/#regexs) for defining regular expressions, where you can read that ‘`\`’ is a [metacharacter](https://www.w3.org/TR/2004/REC-xmlschema-2-20041028/#dt-metac) and which [single character escape·](https://www.w3.org/TR/2004/REC-xmlschema-2-20041028/#dt-cces1)s are:

So ‘`\`’ need to be escaped to ‘`\\`’, and ‘`\`’ is not a valid single character escape.

Note that you should use single ticks `'` around your pattern, not double ticks` "`.
