Skip to content

Commit

Permalink
Merge pull request #153 from button/pr144
Browse files Browse the repository at this point in the history
Pr144
  • Loading branch information
wessmith authored May 31, 2019
2 parents 3b1aaee + 94874fe commit c5e737b
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
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

0 comments on commit c5e737b

Please sign in to comment.