Skip to content
This repository was archived by the owner on Aug 26, 2020. It is now read-only.

Commit 6cd4f1a

Browse files
committed
_impl.py: Fix alphanum character class
Fixes #9
1 parent 81478d2 commit 6cd4f1a

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

src/js_regex/_impl.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,8 @@ def compile(pattern, flags=0):
5555
(r"\a", "\a"),
5656
(r"\d", "[0-9]"),
5757
(r"\D", "[^0-9]"),
58-
(r"\w", "[A-Za-z]"),
59-
(r"\W", "[^A-Za-z]"),
58+
(r"\w", "[A-Za-z0-9_]"),
59+
(r"\W", "[^A-Za-z0-9_]"),
6060
(r"\s", "[ \t\n\r\x0b\x0c]"),
6161
(r"\S", "[^ \t\n\r\x0b\x0c]"),
6262
]:

test_js_regex.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,8 @@ def test_expected_transforms(pattern, good_match, bad_match):
4141
pytest.param(r"\d", "1", "߀", marks=SKIP_ON_PY2), # NKO DIGIT ZERO
4242
(r"\D", "߀", "1"),
4343
pytest.param(r"\w", "a", "é", marks=SKIP_ON_PY2), # Latin-1 e-acute
44+
(r"\w", "1", "߀"),
45+
(r"\w", "_", "/"),
4446
(r"\W", "é", "a"),
4547
pytest.param(r"\s", "\t", "\xa0", marks=SKIP_ON_PY2), # non-breaking space
4648
(r"\S", "\xa0", "\t"),

0 commit comments

Comments
 (0)