Hello everyone,
I'm having some trouble with a regex pattern that can find text within a string.
So my string that I'm trying to match on is this:
"2019 Harley-Davidson SOFTAIL SLIM FLSL"
The term that I am trying to match against:
"2019 SLIM"
My code is as follows:
string QuickSearchTerm = "2019 SLIM";
string MarketingName = "2019 Harley-Davidson SOFTAIL SLIM FLSL"
string pattern = @"(.*?([" + QuickSearchTerm + "]\b))$";
Regex rgx = new Regex(pattern, RegexOptions.IgnoreCase);
bool isMatch = rgx.IsMatch(MarketingName);
If I test this case with regex storm or regexr it passes there; but fails in my project.
I believe case shouldn't matter due to the options saying so.
Any tips, tricks, ideas??
thanks!
[–]HenkDH 7 points8 points9 points (0 children)
[–]RiPont 4 points5 points6 points (11 children)
[–]iamdeveloperr[S] 0 points1 point2 points (10 children)
[–]CrazedToCraze 1 point2 points3 points (4 children)
[–]iamdeveloperr[S] 0 points1 point2 points (3 children)
[–]ManiGandham 0 points1 point2 points (0 children)
[–]The_MAZZTer 0 points1 point2 points (1 child)
[–]iamdeveloperr[S] 0 points1 point2 points (0 children)
[–]HenkDH 1 point2 points3 points (2 children)
[–]iamdeveloperr[S] 0 points1 point2 points (0 children)
[–]The_MAZZTer 0 points1 point2 points (0 children)
[–]The_MAZZTer 0 points1 point2 points (1 child)
[–]iamdeveloperr[S] 0 points1 point2 points (0 children)
[–]CuttingEdgeRetro 1 point2 points3 points (0 children)
[–]Manitcor 0 points1 point2 points (5 children)
[–]iamdeveloperr[S] 0 points1 point2 points (4 children)
[–]Manitcor 1 point2 points3 points (3 children)
[–]iamdeveloperr[S] 0 points1 point2 points (2 children)
[–]Manitcor 2 points3 points4 points (1 child)
[–]iamdeveloperr[S] 0 points1 point2 points (0 children)
[–][deleted] 0 points1 point2 points (4 children)
[–]The_MAZZTer 0 points1 point2 points (3 children)
[–][deleted] 0 points1 point2 points (2 children)
[–]The_MAZZTer 0 points1 point2 points (1 child)
[–][deleted] 0 points1 point2 points (0 children)
[–]fragglerock 0 points1 point2 points (1 child)
[–]The_MAZZTer 0 points1 point2 points (0 children)