Code Explainers

Code explainers tagged #named-groups

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