Skip to content

Commit

Permalink
Make TitleLine "by" prefix optional
Browse files Browse the repository at this point in the history
  • Loading branch information
menees committed Feb 11, 2024
1 parent 7396e2e commit 1cb1637
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
<IsPublishable>false</IsPublishable>

<!-- Make the assembly, file, and NuGet package versions the same. -->
<Version>0.9.2-beta</Version>
<Version>0.9.3-beta</Version>
<UseLocaMeneesLibraries>false</UseLocaMeneesLibraries>
<LocaMeneesLibrariesSrc/>
<BuildingInsideVisualStudio Condition="'$(BuildingInsideVisualStudio)' == ''">false</BuildingInsideVisualStudio>
Expand Down
2 changes: 1 addition & 1 deletion src/Menees.Chords/TitleLine.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public sealed class TitleLine : TextEntry

private const string TitleRegexPattern = """
(?inx)^\s* # Ignore leading whitespace
(?<title>\S.*?)(\s+([\-–—]|((Chords|Tab|Official|Bass|Ukulele|Power|Guitar\s+Pro)\s+by))\s+(?<artist>\S.*?))? # Title with optional artist
(?<title>\S.*?)(\s+([\-–—]|(((Chords|Tab|Official|Bass|Ukulele|Power|Guitar\s+Pro)\s+)?by))\s+(?<artist>\S.*?))? # Title with optional artist
([\.,;][\t ](?<metadata>\S.*?))* # Optional other info. Change last * to ? to see all captures as one.
[\.;]?\s*$ # Optional trailing "separator" and whitespace
""";
Expand Down
6 changes: 6 additions & 0 deletions tests/Menees.Chords.Tests/TitleLineTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,12 @@ public void TryParseValidTest()
("title", "Pretty Little Lie"),
("artist", "Blackberry Smoke"));

Test(
"Free Bird by Lynyrd Skynyrd. Key: G.",
("title", "Free Bird"),
("artist", "Lynyrd Skynyrd"),
("key", "G"));

Test(
"Free Bird Official by Lynyrd Skynyrd. Key: G. Bpm: 110,150.",
("title", "Free Bird"),
Expand Down

0 comments on commit 1cb1637

Please sign in to comment.