您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

12345678910111213
  1. 'use strict';
  2. module.exports = string => {
  3. if (typeof string !== 'string') {
  4. throw new TypeError('Expected a string');
  5. }
  6. // Escape characters with special meaning either inside or outside character sets.
  7. // Use a simple backslash escape when it’s always valid, and a \unnnn escape when the simpler form would be disallowed by Unicode patterns’ stricter grammar.
  8. return string
  9. .replace(/[|\\{}()[\]^$+*?.]/g, '\\$&')
  10. .replace(/-/g, '\\x2d');
  11. };