Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

std.regex: Fix math in replace example

Not only was the sum of two numbers incorrect, but the replace
operation seemingly added 100 to the result as well ;)
  • Loading branch information...
commit f25f1f7f41a03999c7abb14789424dc144ae5347 1 parent 071aa17
@CyberShadow authored
Showing with 1 addition and 1 deletion.
  1. +1 −1  std/regex.d
View
2  std/regex.d
@@ -6557,7 +6557,7 @@ public auto bmatch(R, RegEx)(R input, RegEx re)
---
//Comify a number
auto com = regex(r"(?<=\d)(?=(\d\d\d)+\b)","g");
- assert(replace("12000 + 42100 = 56000", com, ",") == "12,000 + 42,100 = 56,100");
+ assert(replace("12000 + 42100 = 54100", com, ",") == "12,000 + 42,100 = 54,100");
---
The format string can reference parts of match using the following notation.
Please sign in to comment.
Something went wrong with that request. Please try again.