Skip to content

Commit

Permalink
Move Regex to static variable
Browse files Browse the repository at this point in the history
  • Loading branch information
millicentachieng committed Dec 3, 2024
1 parent 7448217 commit e2548ff
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions ApiDoctor.Console/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ namespace ApiDoctor.ConsoleApp
using Validation.Params;
using Validation.Writers;

class Program
partial class Program
{
private const int ExitCodeFailure = 1;
private const int ExitCodeSuccess = 0;
Expand Down Expand Up @@ -3047,7 +3047,7 @@ private static string ConvertToThreeColumnPermissionsTable(IEnumerable<string> t
{
try
{
string[] cells = Regex.Split(row.Trim(), @"\s*\|\s*").Where(static x => !string.IsNullOrWhiteSpace(x)).ToArray();
string[] cells = PipeDelimiterRegex.Split(row.Trim()).Where(static x => !string.IsNullOrWhiteSpace(x)).ToArray();

// We already have the 3 column permissions table, abort
if (cells.Length == 3)
Expand Down Expand Up @@ -3203,6 +3203,8 @@ private enum PermissionsInsertionState
FindNextPermissionBlock
}

private static readonly Regex PipeDelimiterRegex = new Regex(@"\s*\|\s*", RegexOptions.Compiled);

#endregion

/// <summary>
Expand Down

0 comments on commit e2548ff

Please sign in to comment.