Skip to content

Commit 6af8e2d

Browse files
committed
fixes #19 - missed point added
1 parent 5259264 commit 6af8e2d

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

chapters/ch04.2-writing-logs.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -436,7 +436,7 @@ There's a lot going on in this method. Let's break it down.
436436
You can also use special characters within character classes to match certain character types, like `\d` for digits, `\w` for word characters, `\s` for whitespace, etc.
437437

438438
In this case we are looking for all the dot (`.`) characters and colon (`:`) characters in the string.
439-
439+
440440
- `\.` matches a literal dot character. Since the dot (`.`) is a special character in regular expression, known as a wildcard. It matches any single character except for a newline character (`\n`). This is useful when you want to match any character, which is often used in pattern matching.
441441

442442
However, in this case, we want to match a literal dot character in the string (the dot in the date-time format "00.000Z"). To achieve this, we need to escape the dot character by preceding it with a backslash (`\`). When you place a backslash before a special character, it indicates that you want to match the literal character itself, rather than its special meaning.
@@ -445,7 +445,7 @@ There's a lot going on in this method. Let's break it down.
445445

446446
- `/g` is the global flag, indicating that the replacement should be applied to all occurrences of the pattern.
447447

448-
- So, the regex `\..+` matches the dot and all characters after it in the string.
448+
- So, the regex `[\.:]+` matches the dot or colon and all the repeated occurences of these 2 characters.
449449

450450
- The replacement `""` removes the dot and all characters after it.
451451

0 commit comments

Comments
 (0)