How to use "\" in pattern?

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

The YANG RFC https://tools.ietf.org/html/rfc7950#section-9.4.5 point to https://www.w3.org/TR/2004/REC-xmlschema-2-20041028/#regexs for defining regular expressions, where you can read that ‘\’ is a metacharacter and which single character escape·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 ".