Skip to content

Commit

Permalink
use literal strings
Browse files Browse the repository at this point in the history
  • Loading branch information
rkm committed Aug 23, 2023
1 parent 9283d69 commit e3b7ea2
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions IsIdentifiable/Rules/PartPatternFilterRule.cs
Original file line number Diff line number Diff line change
Expand Up @@ -65,15 +65,15 @@ public bool Covers(FailurePart failurePart, string problemValue)
if (!string.IsNullOrWhiteSpace(WordBefore))
{
var problemValueUpToOffset = problemValue[..(failurePart.Offset + failurePart.Word.Length)];
var wordBeforeRegex = new Regex($"\\b{WordBefore}(\\s|-)+{IfPartPattern.TrimStart('^')}", (CaseSensitive ? RegexOptions.None : RegexOptions.IgnoreCase));
var wordBeforeRegex = new Regex(@$"\b{WordBefore}(\s|-)+{IfPartPattern.TrimStart('^')}", (CaseSensitive ? RegexOptions.None : RegexOptions.IgnoreCase));
matchesBefore = wordBeforeRegex.Matches(problemValueUpToOffset).Any();
}

bool matchesAfter = false;
if (!string.IsNullOrWhiteSpace(WordAfter))
{
var problemValueFromOffset = problemValue[failurePart.Offset..];
var wordAfterRegex = new Regex($"{IfPartPattern.TrimEnd('$')}(\\s|-)+{WordAfter}\\b", (CaseSensitive ? RegexOptions.None : RegexOptions.IgnoreCase));
var wordAfterRegex = new Regex(@$"{IfPartPattern.TrimEnd('$')}(\s|-)+{WordAfter}\b", (CaseSensitive ? RegexOptions.None : RegexOptions.IgnoreCase));
matchesAfter = wordAfterRegex.Matches(problemValueFromOffset).Any();
}

Expand Down

0 comments on commit e3b7ea2

Please sign in to comment.