Skip to content

Commit d9d0a6e

Browse files
committed
Use a simpler regex for identifying character names in LineParser
1 parent ae120ca commit d9d0a6e

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

YarnSpinner/YarnSpinner.Markup/LineParser.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1486,7 +1486,7 @@ internal MarkupParseResult ParseString(string input, string localeCode, bool squ
14861486
return ParseStringWithDiagnostics(input, localeCode, squish, sort, addImplicitCharacterAttribute).markup;
14871487
}
14881488

1489-
private static readonly System.Text.RegularExpressions.Regex implicitCharacterRegex = new(@"^(?<name>((?:[^:\\]|\\.)*?(?<!\\)))(?<suffix>:\s*)");
1489+
private static readonly System.Text.RegularExpressions.Regex implicitCharacterRegex = new(@"^((?:[^:\\]|\\.)*):\s*");
14901490

14911491
// Matches a "[character" at the start of the string, which means that
14921492
// the string contains an explicit character marker.
@@ -1509,7 +1509,7 @@ internal MarkupParseResult ParseString(string input, string localeCode, bool squ
15091509
// replace it with markup that indicates the character name.
15101510
input = implicitCharacterRegex.Replace(
15111511
input,
1512-
(match) => $"[character name=\"{match.Groups["name"]}\"]{match.Groups["name"]}{match.Groups["suffix"]}[/character]"
1512+
(match) => $"[character name=\"{match.Groups[0]}\"]{match.Value}[/character]"
15131513
);
15141514
}
15151515

0 commit comments

Comments
 (0)