Visitar URL original
Centralize matching code and avoid regex by edwardmiller-mesirow · Pull Request #550 · dotnet-outdated/dotnet-outdated · GitHub
Skip to content

Centralize matching code and avoid regex - #550

Open
edwardmiller-mesirow wants to merge 4 commits into
dotnet-outdated:masterfrom
edwardmiller-mesirow:dry
Open

edwardmiller-mesirow wants to merge 4 commits into
dotnet-outdated:masterfrom
edwardmiller-mesirow:dry

Conversation

@edwardmiller-mesirow

Copy link
Copy Markdown
Contributor

This complicated code was duplicated and could be centralized.

.TakeWhile(p => p.matches)
.Select(p => p.part));
if (matching.Length > 0) { matching += '.'; }
var rest = new Regex($"^{matching}").Replace(latestString, "");

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually, regex can be avoided entirely, and a StartsWith string function would be faster.

@edwardmiller-mesirow edwardmiller-mesirow changed the title Centralize regular expression code Centralize regular expression code and add regex caching Apr 9, 2025
@edwardmiller-mesirow edwardmiller-mesirow changed the title Centralize regular expression code and add regex caching Avoid regex Apr 9, 2025
@edwardmiller-mesirow edwardmiller-mesirow changed the title Avoid regex Centralize matching code and avoid regex Apr 9, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants