← Explore practical examples

FOUNDATION · ICU

Parse a log

Copy the pattern and text into a8s Regex, enable the flags shown, then paste the replacement to check the preview.

Pattern

^\[(INFO|WARN|ERROR)\]\s+(.+)$

Flags

g, m

Sample text

[INFO] Server started
[WARN] Cache almost full
[ERROR] Connection refused

Replacement

$1: $2

Expected output

INFO: Server started
WARN: Cache almost full
ERROR: Connection refused

View on the App Store ↗