From 4da1ac91190f4a1bc5e75bb68c0f96c6563e37b0 Mon Sep 17 00:00:00 2001 From: Christopher Govender - Kubiec Date: Fri, 8 Jun 2018 21:50:25 +0100 Subject: [PATCH] Fixed Regex --- src/Humanizer.Tests.Shared/ArticlePrefixSortTests.cs | 2 +- src/Humanizer/ArticlePrefixSort.cs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Humanizer.Tests.Shared/ArticlePrefixSortTests.cs b/src/Humanizer.Tests.Shared/ArticlePrefixSortTests.cs index c1ee734f2..2a77b5e82 100644 --- a/src/Humanizer.Tests.Shared/ArticlePrefixSortTests.cs +++ b/src/Humanizer.Tests.Shared/ArticlePrefixSortTests.cs @@ -6,7 +6,7 @@ namespace Humanizer.Tests public class ArticlePrefixSortTests { [Theory] - [InlineData(new string[] { "an ant", "The Theater", "The apple", "Fox", "Bear" }, new string[] { "an ant", "The apple", "Bear", "Fox", "The Theater" })] + [InlineData(new string[] { "Ant", "The Theater", "The apple", "Fox", "Bear" }, new string[] { "Ant", "The apple", "Bear", "Fox", "The Theater" })] public void SortStringArrayIgnoringArticlePrefixes(string[] input, string[] expectedOutput) { Assert.Equal(expectedOutput, EnglishArticle.PrependArticleSuffix(EnglishArticle.AppendArticlePrefix(input))); diff --git a/src/Humanizer/ArticlePrefixSort.cs b/src/Humanizer/ArticlePrefixSort.cs index dcf058728..0f82565cb 100644 --- a/src/Humanizer/ArticlePrefixSort.cs +++ b/src/Humanizer/ArticlePrefixSort.cs @@ -18,7 +18,7 @@ public static string[] AppendArticlePrefix(string[] items) if (items.Length == 0) throw new ArgumentOutOfRangeException(nameof(items)); - Regex regex = new Regex("^((The)|(the)|(a)|(A)|(An)|(an))"); + Regex regex = new Regex("^((The)|(the)|(a)|(A)|(An)|(an))\\s\\w+"); string[] transformed = new string[items.Length]; string article, removed, appended;