pySohila’s learning labPYTHON / FIELD GUIDE 01

Choose your next depth / OPTIONAL DEPTH

Regex, Unicode & Arabic text

Treat encoding, normalization and business identifiers as separate decisions.

3h planning budget · Sohila Khaled Abbas · Reviewed 2026-11-01

Apply this to your Python data tools, PixelFed quality work, n8n integrations or BI delivery when the project needs it.

Understand the idea

Encoding converts bytes to text. Normalization changes the representation of some equivalent Unicode sequences. Neither operation decides whether two customer names represent the same person, and stripping Arabic characters is not a valid cleaning default.

Use a regular expression for a bounded structural rule, such as an order identifier. A pattern proving that text resembles an email or phone number cannot prove the person owns it. Keep that distinction clear when designing intake or data-quality rules.

What to learn

A small original example

import re
import unicodedata

raw = "عناية بالبشرة"
normalized = unicodedata.normalize("NFC", raw)
valid_id = re.fullmatch(r"O[0-9]{3}", "O001") is not None
print(normalized, valid_id)

Practice on your own data

Validate ASCII order IDs, preserve Arabic category labels, and compare composed/decomposed forms without overwriting the raw value.

Practice this lesson in the Python lab →

EXIT CHECK

Arabic text round-trips; invalid identifiers fail; normalization is recorded and never silently merges distinct business keys.

Prerequisites

Variables, types & missing values · Files, CSV, JSON & paths

Sources and further reading

Track progress on this topic → · Markdown source ↗