Merge pull request #19259 from JunTaoLuo/regex-woes

Avoid regex inefficiencies in no-match scenarios
pull/19314/head
Jan Tattermusch 6 years ago committed by GitHub
commit cc0653207a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 8
      src/csharp/Grpc.Tools/ProtoCompile.cs

@ -136,7 +136,7 @@ namespace Grpc.Tools
new ErrorListFilter
{
Pattern = new Regex(
pattern: "(?'FILENAME'.+)\\((?'LINE'\\d+)\\) ?: ?warning in column=(?'COLUMN'\\d+) ?: ?(?'TEXT'.*)",
pattern: "^(?'FILENAME'.+?)\\((?'LINE'\\d+)\\) ?: ?warning in column=(?'COLUMN'\\d+) ?: ?(?'TEXT'.*)",
options: RegexOptions.Compiled | RegexOptions.IgnoreCase,
matchTimeout: s_regexTimeout),
LogAction = (log, match) =>
@ -162,7 +162,7 @@ namespace Grpc.Tools
new ErrorListFilter
{
Pattern = new Regex(
pattern: "(?'FILENAME'.+)\\((?'LINE'\\d+)\\) ?: ?error in column=(?'COLUMN'\\d+) ?: ?(?'TEXT'.*)",
pattern: "^(?'FILENAME'.+?)\\((?'LINE'\\d+)\\) ?: ?error in column=(?'COLUMN'\\d+) ?: ?(?'TEXT'.*)",
options: RegexOptions.Compiled | RegexOptions.IgnoreCase,
matchTimeout: s_regexTimeout),
LogAction = (log, match) =>
@ -188,7 +188,7 @@ namespace Grpc.Tools
new ErrorListFilter
{
Pattern = new Regex(
pattern: "(?'FILENAME'.+): ?warning: ?(?'TEXT'.*)",
pattern: "^(?'FILENAME'.+?): ?warning: ?(?'TEXT'.*)",
options: RegexOptions.Compiled | RegexOptions.IgnoreCase,
matchTimeout: s_regexTimeout),
LogAction = (log, match) =>
@ -211,7 +211,7 @@ namespace Grpc.Tools
new ErrorListFilter
{
Pattern = new Regex(
pattern: "(?'FILENAME'.+): ?(?'TEXT'.*)",
pattern: "^(?'FILENAME'.+?): ?(?'TEXT'.*)",
options: RegexOptions.Compiled | RegexOptions.IgnoreCase,
matchTimeout: s_regexTimeout),
LogAction = (log, match) =>

Loading…
Cancel
Save