Title: Regular expression in DiffUtils is too strict and will fail. · Issue #41 · dnaumenko/java-diff-utils · GitHub
Open Graph Title: Regular expression in DiffUtils is too strict and will fail. · Issue #41 · dnaumenko/java-diff-utils
X Title: Regular expression in DiffUtils is too strict and will fail. · Issue #41 · dnaumenko/java-diff-utils
Description: In DiffUtils, there is the following regular expression: public class DiffUtils { private static Pattern unifiedDiffChunkRe = Pattern .compile("^@@\\s+-(?:(\\d+)(?:,(\\d+))?)\\s+\\+(?:(\\d+)(?:,(\\d+))?)\\s+@@$"); This will fail if there...
Open Graph Description: In DiffUtils, there is the following regular expression: public class DiffUtils { private static Pattern unifiedDiffChunkRe = Pattern .compile("^@@\\s+-(?:(\\d+)(?:,(\\d+))?)\\s+\\+(?:(\\d+)(?:,(\\...
X Description: In DiffUtils, there is the following regular expression: public class DiffUtils { private static Pattern unifiedDiffChunkRe = Pattern .compile("^@@\\s+-(?:(\\d+)(?:,(\\d+))?)\\s+\\+(?:(\\d+)(?...
Opengraph URL: https://github.com/dnaumenko/java-diff-utils/issues/41
X: @github
Domain: patch-diff.githubusercontent.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Regular expression in DiffUtils is too strict and will fail.","articleBody":"In DiffUtils, there is the following regular expression:\r\n\r\n```\r\npublic class DiffUtils {\r\n\tprivate static Pattern unifiedDiffChunkRe = Pattern\r\n\t\t\t.compile(\"^@@\\\\s+-(?:(\\\\d+)(?:,(\\\\d+))?)\\\\s+\\\\+(?:(\\\\d+)(?:,(\\\\d+))?)\\\\s+@@$\");\r\n```\r\n\r\nThis will fail if there is a section header after the final @@ which is permitted. See https://en.wikipedia.org/wiki/Diff\r\n\r\n```\r\n\"@@ -l,s +l,s @@ optional section heading\"\r\n```\r\n\r\nThis can be trivially fixed by replacing the regular expression with:\r\n\r\n```\r\n\"^@@\\\\s+-(?:(\\\\d+)(?:,(\\\\d+))?)\\\\s+\\\\+(?:(\\\\d+)(?:,(\\\\d+))?)\\\\s+@@.*$\"\r\n```\r\n\r\n... which will ignore the optional section heading.\r\n\r\nThanks for your project.","author":{"url":"https://github.com/aleppard","@type":"Person","name":"aleppard"},"datePublished":"2023-05-10T08:38:30.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":0},"url":"https://github.com/41/java-diff-utils/issues/41"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:30e6413d-a9f9-c09e-42aa-2df72e38aec9 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | A564:13AC90:6C5E6B:884676:69907977 |
| html-safe-nonce | 594b2656012b56af85e77e43878134dc274a8fdc606ceb01ecff4e319b2fd07f |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBNTY0OjEzQUM5MDo2QzVFNkI6ODg0Njc2OjY5OTA3OTc3IiwidmlzaXRvcl9pZCI6IjY5MDQ2MDc0NDQyMDg0ODI2NzkiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 416e8caf78d64ecf53394b8768cd38d42515010e7641f6534aba128d8f8fdbac |
| hovercard-subject-tag | issue:1703397057 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/dnaumenko/java-diff-utils/41/issue_layout |
| twitter:image | https://opengraph.githubassets.com/787431ea2c9b7cfed83bc49b42c48d4c52146f8f4fd50aaf0b1bc50c2d16322a/dnaumenko/java-diff-utils/issues/41 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/787431ea2c9b7cfed83bc49b42c48d4c52146f8f4fd50aaf0b1bc50c2d16322a/dnaumenko/java-diff-utils/issues/41 |
| og:image:alt | In DiffUtils, there is the following regular expression: public class DiffUtils { private static Pattern unifiedDiffChunkRe = Pattern .compile("^@@\\s+-(?:(\\d+)(?:,(\\d+))?)\\s+\\+(?:(\\d+)(?:,(\\... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | aleppard |
| hostname | github.com |
| expected-hostname | github.com |
| None | 42c603b9d642c4a9065a51770f75e5e27132fef0e858607f5c9cb7e422831a7b |
| turbo-cache-control | no-preview |
| go-import | github.com/dnaumenko/java-diff-utils git https://github.com/dnaumenko/java-diff-utils.git |
| octolytics-dimension-user_id | 158093 |
| octolytics-dimension-user_login | dnaumenko |
| octolytics-dimension-repository_id | 52715583 |
| octolytics-dimension-repository_nwo | dnaumenko/java-diff-utils |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 52715583 |
| octolytics-dimension-repository_network_root_nwo | dnaumenko/java-diff-utils |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 3b33c5aedc9808f45bc5fcf0b1e4404cf749dac7 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width