问Wentian Notes
Tags About
EN
  • 中文
  • English
  • Deutsch
Music Notes Note 4 of 4

Regular Expressions: Character Encoding Matching

28 wordsAbout 1 min
#Python Basics#Files & Encoding

Code

# Use a regular expression to match all Chinese characters, digits and English letters
pattern = r'[一-鿿0-9a-zA-Z]'
charactor_list = re.findall(pattern, text)
text = ''.join(charactor_list)
print(text)
← PreviousScales, Intervals and Chords

Music Notes

  1. The Difference Between 6/8 Time and 2/4 Time Triplets
  2. Shakespeare Quotes
  3. Scales, Intervals and Chords
  4. Regular Expressions: Character Encoding Matching

GitHub

© 2026 Asky · Wentian Notes

⌘K search ←→ previous/next R random note

Esc
    ↑↓ select↵ open