Skip to content

Instantly share code, notes, and snippets.

@kinow
Created December 11, 2018 10:32
Show Gist options
  • Save kinow/d5ecac8f0ebcaa67b2e3c08ead92cf0f to your computer and use it in GitHub Desktop.
Save kinow/d5ecac8f0ebcaa67b2e3c08ead92cf0f to your computer and use it in GitHub Desktop.
test_regex.py
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import re
p = re.compile(r"\d", re.UNICODE)
number_one = "1"
also_number_one = u"߁"
not_a_number = "test"
assert p.match(number_one)
assert p.match(also_number_one)
# only here it won't match
assert not p.match(not_a_number)
print("All good!")