As far as I recall, none of the characters you want to add are “special” in a “Character Group” (the thing inside [ ] in a regular expression), i.e. there is no need to escape them per se. However the [ and ] characters are special (w3c regexps can have “nested” “Character Class Expressions”), i.e. they need to be escaped already in your original pattern.
And of course single quote is “problematic” since you are (wisely) using them for the YANG quoting of the string (as you can see in https://tools.ietf.org/html/rfc7950#section-6.1.3, a single quote can never appear inside a single-quoted string) - but this is most easily handled with “quote switching”. So, your actual pattern can be
[a-zA-Z0-9#$%&()*+,.:/<=>@^_{}~^\[\]\-!;?"|']+
and to properly quote this for YANG, you can use
pattern '[a-zA-Z0-9#$%&()*+,.:/<=>@^_{}~^\[\]\-!;?"|' + "']+";
However since it seems you want to include all printable ASCII characters (except space), this might be more easily expressed as
pattern '[!-~]+';
If there are some of those characters you want to exclude, you can always “split the range” and skip them that way,