Skip to content
Merged

Pr144 #153

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion DeepLinkKit/Regex/DPLRegularExpression.m
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#import "DPLRegularExpression.h"

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

Expand Down
11 changes: 10 additions & 1 deletion Tests/Regex/DPLRegularExpressionSpec.m
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,16 @@
DPLMatchResult *matchResult = [expression matchResultForString:@"/hello/dovalue/thisvalue/and/thatvalue"];
expect(matchResult.match).to.beFalsy();
});


it(@"should match named components with single character", ^{
DPLRegularExpression *expression = [DPLRegularExpression regularExpressionWithPattern:@"/hello/:a/:b/and/:c"];

DPLMatchResult *matchResult = [expression matchResultForString:@"/hello/dovalue/thisvalue/and/thatvalue"];
expect(matchResult.match).to.beTruthy();
expect(matchResult.namedProperties).to.equal(@{ @"a": @"dovalue",
@"b": @"thisvalue",
@"c": @"thatvalue" });
});
});

SpecEnd