Code Explainers

Code explainers tagged #named-groups

python
import re
from functools import total_ordering
from typing import Optional
 

Parsing and comparing semantic versions

regex operator-overloading sorting
Intermediate 7 steps
typescript
interface ContentRange {
  unit: string;
  start: number;
  end: number;

Parsing HTTP Content-Range headers in TypeScript

regex parsing validation
Intermediate 8 steps
go
package parser
 
import (
	"fmt"

Parsing access logs with named regex groups in Go

regex named-groups parsing
Intermediate 5 steps
java
public final class AccessLogParser {
 
    private static final Pattern LINE = Pattern.compile(
        "^(?<ip>\\S+) \\S+ \\S+ \\[(?<time>[^\\]]+)\\] "

Parsing Apache access logs in Java

regex named-groups parsing
Intermediate 7 steps
python
import re
from collections import defaultdict
from pathlib import Path
 

Summarizing log files by date in Python

regex parsing aggregation
Intermediate 7 steps
python
import re
from datetime import datetime
from dataclasses import dataclass
 

Parsing access logs with named regex groups

regex named-groups dataclasses
Intermediate 6 steps