Skip to content

[RegexDiff X64] [Copilot] Fix BOL anchor not writing back updated position i ... #1804

@MihuBot

Description

@MihuBot

Job completed in 19 minutes 7 seconds (remote runner delay: 1 minute 23 seconds).
dotnet/runtime#125280
Using arguments: regexdiff
Main commit: dotnet/runtime@703be08
PR commit: dotnet/runtime@96de71a

172 out of 18857 patterns have generated source code changes.

Examples of GeneratedRegex source diffs
"^" (5871 uses)
[GeneratedRegex("^", RegexOptions.Multiline)]
      {
          goto NoMatchFound;
      }
+       base.runtextpos = pos;
  }
  
  return true;
"^#include <([^>]+)>\\s*$" (2606 uses)
[GeneratedRegex("^#include <([^>]+)>\\s*$", RegexOptions.IgnoreCase | RegexOptions.Multiline)]
      {
          goto NoMatchFound;
      }
+       base.runtextpos = pos;
  }
  
  // The pattern has the literal "#include" ordinal case-insensitive at the beginning of the pattern. Find the next occurrence.
"^-+ *BEGIN (?<keyName>\\w+( \\w+)*) PRIVATE ..." (1964 uses)
[GeneratedRegex("^-+ *BEGIN (?<keyName>\\w+( \\w+)*) PRIVATE KEY *-+\\r?\\n(Proc-Type: 4,ENCRYPTED\\r?\\nDEK-Info: (?<cipherName>[A-Z0-9-]+),(?<salt>[A-F0-9]+)\\r?\\n\\r?\\n)?(?<data>([a-zA-Z0-9/+=]{1,80}\\r?\\n)+)-+ *END \\k<keyName> PRIVATE KEY *-+", RegexOptions.Multiline)]
      {
          goto NoMatchFound;
      }
+       base.runtextpos = pos;
  }
  
  // The pattern begins with a character in the set \-.
"^ *> ?" (823 uses)
[GeneratedRegex("^ *> ?", RegexOptions.Multiline)]
      {
          goto NoMatchFound;
      }
+       base.runtextpos = pos;
  }
  
  // The pattern begins with a character in the set [ >].
"^ +$" (823 uses)
[GeneratedRegex("^ +$", RegexOptions.Multiline)]
      {
          goto NoMatchFound;
      }
+       base.runtextpos = pos;
  }
  
  // The pattern begins with a character in the set  .
"^ {4}" (823 uses)
[GeneratedRegex("^ {4}", RegexOptions.Multiline)]
      {
          goto NoMatchFound;
      }
+       base.runtextpos = pos;
  }
  
  // The pattern has the literal "    " at the beginning of the pattern. Find the next occurrence.
"^( *)((?:[*+-]|\\d+\\.)) [^\\n]*(?:\\n(?!\\1 ..." (823 uses)
[GeneratedRegex("^( *)((?:[*+-]|\\d+\\.)) [^\\n]*(?:\\n(?!\\1(?:[*+-]|\\d+\\.) )[^\\n]*)*", RegexOptions.Multiline)]
      {
          goto NoMatchFound;
      }
+       base.runtextpos = pos;
  }
  
  // The pattern begins with a character in the set [ *+\-\d].
"^(\\d+)\\.(\\d+)\\.(\\d+)" (599 uses)
[GeneratedRegex("^(\\d+)\\.(\\d+)\\.(\\d+)", RegexOptions.Multiline)]
      {
          goto NoMatchFound;
      }
+       base.runtextpos = pos;
  }
  
  // The pattern begins with a Unicode digit.
"\r\n ^\r\n [\\x20\\t]* ..." (569 uses)
[GeneratedRegex("\r\n            ^\r\n            [\\x20\\t]*\r\n            \\w+ [\\x20\\t]+\r\n            (?<frame>\r\n                (?<type> [^\\x20\\t]+ ) \\.\r\n                (?<method> [^\\x20\\t]+? ) [\\x20\\t]*\r\n                (?<params>  \\( ( [\\x20\\t]* \\)\r\n                               |                    (?<pt> .+?) [\\x20\\t]+ (?<pn> .+?)\r\n                                 (, [\\x20\\t]* (?<pt> .+?) [\\x20\\t]+ (?<pn> .+?) )* \\) ) )\r\n                ( [\\x20\\t]+\r\n                    ( # Microsoft .NET stack traces\r\n                    \\w+ [\\x20\\t]+\r\n                    (?<file> [a-z] \\: .+? )\r\n                    \\: \\w+ [\\x20\\t]+\r\n                    (?<line> [0-9]+ ) \\p{P}?\r\n                    | # Mono stack traces\r\n                    \\[0x[0-9a-f]+\\] [\\x20\\t]+ \\w+ [\\x20\\t]+\r\n                    <(?<file> [^>]+ )>\r\n                    :(?<line> [0-9]+ )\r\n                    )\r\n                )?\r\n            )\r\n            \\s*\r\n            $", RegexOptions.IgnoreCase | RegexOptions.Multiline | RegexOptions.ExplicitCapture | RegexOptions.IgnorePatternWhitespace | RegexOptions.CultureInvariant)]
      {
          goto NoMatchFound;
      }
+       base.runtextpos = pos;
  }
  
  // The pattern begins with a character in the set [\t \w].
"^LD_LIBRARY_PATH=(.*)$" (526 uses)
[GeneratedRegex("^LD_LIBRARY_PATH=(.*)$", RegexOptions.Multiline)]
      {
          goto NoMatchFound;
      }
+       base.runtextpos = pos;
  }
  
  // The pattern has the literal "LD_LIBRARY_PATH=" at the beginning of the pattern. Find the next occurrence.

For more diff examples, see https://gist.github.com/MihuBot/d7021d5c0016c70a0e532293f19acdab

JIT assembly changes
Total bytes of base: 55609071
Total bytes of diff: 55610219
Total bytes of delta: 1148 (0.00 % of base)
Total relative delta: 4.41
    diff is a regression.
    relative diff is a regression.

For a list of JIT diff regressions, see Regressions.md

Sample source code for further analysis
const string JsonPath = "RegexResults-1804.json";
if (!File.Exists(JsonPath))
{
    await using var archiveStream = await new HttpClient().GetStreamAsync("https://mihubot.xyz/r/FIih1ySA");
    using var archive = new ZipArchive(archiveStream, ZipArchiveMode.Read);
    archive.Entries.First(e => e.Name == "Results.json").ExtractToFile(JsonPath);
}

using FileStream jsonFileStream = File.OpenRead(JsonPath);
RegexEntry[] entries = JsonSerializer.Deserialize<RegexEntry[]>(jsonFileStream, new JsonSerializerOptions { IncludeFields = true })!;
Console.WriteLine($"Working with {entries.Length} patterns");



record KnownPattern(string Pattern, RegexOptions Options, int Count);

sealed class RegexEntry
{
    public required KnownPattern Regex { get; set; }
    public required string MainSource { get; set; }
    public required string PrSource { get; set; }
    public string? FullDiff { get; set; }
    public string? ShortDiff { get; set; }
    public (string Name, string Values)[]? SearchValuesOfChar { get; set; }
    public (string[] Values, StringComparison ComparisonType)[]? SearchValuesOfString { get; set; }
}

Artifacts:

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions