Skip to content

Instantly share code, notes, and snippets.

@githubhy
Last active May 4, 2022 10:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save githubhy/179559994119a43d2b17129c3817153e to your computer and use it in GitHub Desktop.
Save githubhy/179559994119a43d2b17129c3817153e to your computer and use it in GitHub Desktop.
Regular expression for Chinese characters
perl: /[^u4E00-u9FA5]/
js: match(/[\u4E00-\u9FA5]/)
Example:
use `<([^u4E00-u9FA5]*<[^u4E00-u9FA5]+>[^u4E00-u9FA5]*)*>` to match `<封爵 河津亭侯→安國鄉侯→向鄉侯→舞陽侯→晉王<追尊>→晉帝<追尊>>`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment