Skip to content

Commit c5e737b

Browse files
authored
Merge pull request #153 from button/pr144
Pr144
2 parents 3b1aaee + 94874fe commit c5e737b

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

DeepLinkKit/Regex/DPLRegularExpression.m

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#import "DPLRegularExpression.h"
22

3-
static NSString * const DPLNamedGroupComponentPattern = @":[a-zA-Z0-9-_][^/]+";
3+
static NSString * const DPLNamedGroupComponentPattern = @":[a-zA-Z0-9-_]+[^/]*";
44
static NSString * const DPLRouteParameterPattern = @":[a-zA-Z0-9-_]+";
55
static NSString * const DPLURLParameterPattern = @"([^/]+)";
66

Tests/Regex/DPLRegularExpressionSpec.m

+10-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,16 @@
4040
DPLMatchResult *matchResult = [expression matchResultForString:@"/hello/dovalue/thisvalue/and/thatvalue"];
4141
expect(matchResult.match).to.beFalsy();
4242
});
43-
43+
44+
it(@"should match named components with single character", ^{
45+
DPLRegularExpression *expression = [DPLRegularExpression regularExpressionWithPattern:@"/hello/:a/:b/and/:c"];
46+
47+
DPLMatchResult *matchResult = [expression matchResultForString:@"/hello/dovalue/thisvalue/and/thatvalue"];
48+
expect(matchResult.match).to.beTruthy();
49+
expect(matchResult.namedProperties).to.equal(@{ @"a": @"dovalue",
50+
@"b": @"thisvalue",
51+
@"c": @"thatvalue" });
52+
});
4453
});
4554

4655
SpecEnd

0 commit comments

Comments
 (0)