Skip to content

Commit 4802e94

Browse files
author
attwad
committed
allow + as a character matched by the osc address whildcard *. Fixes attwad#7
1 parent a41c1a1 commit 4802e94

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

pythonosc/dispatcher.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ def handlers_for_address(self, address_pattern):
3636
pattern = address_pattern.replace('?', '\\w?')
3737
# '*' in the OSC Address Pattern matches any sequence of zero or more
3838
# characters.
39-
pattern = pattern.replace('*', '\\w*')
39+
pattern = pattern.replace('*', '[\\w|\\\\+]*')
4040
# The rest of the syntax in the specification is like the re module so
4141
# we're fine.
4242
pattern = pattern + '$'

pythonosc/test/test_dispatcher.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,5 +68,11 @@ def test_match_multiple_stars(self):
6868
self.sortAndAssertSequenceEqual(
6969
[(1, []), (2, [])], self.dispatcher.handlers_for_address("/*/*/*"))
7070

71+
def test_match_address_contains_plus_as_character(self):
72+
self.dispatcher.map('/footest/bar+tender/1', 1)
73+
74+
self.sortAndAssertSequenceEqual(
75+
[(1, [])], self.dispatcher.handlers_for_address("/foo*/bar+*/*"))
76+
7177
if __name__ == "__main__":
7278
unittest.main()

0 commit comments

Comments
 (0)