Skip to content

Commit 90ea224

Browse files
Added Uuid matcher into the RegexConverter
1 parent bb561b0 commit 90ea224

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

src/Matcher/Pattern/RegexConverter.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ public function toRegex(TypePattern $typePattern) : string
2121
return '(\\-?[0-9]*)';
2222
case 'double':
2323
return '(\\-?[0-9]*[\\.|\\,][0-9]*)';
24+
case 'uuid':
25+
return "([\da-f]{8}-[\da-f]{4}-[1-5][\da-f]{3}-[89ab][\da-f]{3}-[\da-f]{12})";
2426
default:
2527
throw new UnknownTypeException($typePattern->getType());
2628
}

tests/Matcher/TextMatcherTest.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,16 @@ public function matchingData()
107107
'/users/12345/active',
108108
'/users/@[email protected](0)/active',
109109
true
110+
],
111+
[
112+
'/user/ebd1fb0e-45ae-11e8-842f-0ed5f89f718b/profile',
113+
'/user/@uuid@/@string@',
114+
true
115+
],
116+
[
117+
'/user/12345/profile',
118+
'/user/@uuid@/@string@',
119+
false
110120
]
111121
];
112122
}

0 commit comments

Comments
 (0)