Extract Named Date and Status Groups From Sanitized Logs
A named capture lets a reviewer confirm exactly which field a regular expression extracted. Build a fixture small enough to explain each match.
Create representative synthetic lines
Use a line such as 2026-11-27 200, another success or error status, and a line with a malformed date shape. Leave identifiers, addresses and private request data out.
Test the expression and flags
Enter ^(?<date>\d\d\d\d-\d\d-\d\d)[ ]+(?<status>\d\d\d)$ in Regex Tester. Use m for line anchors. Use g if you want all representative matches. Read the captured values and match positions in the output.
Review what the pattern establishes
The date shape can match a value that is not a real calendar date. The status group checks three digits rather than validating status semantics. Validate actual field values separately in the application.
Save both positive and negative cases
Record the expression, flags and expected named fields. Recheck an additional invalid line before treating the pattern as ready for sanitized data.
Ferkesh Tools
Related guides
Official references
Ferkesh Hosting. Last reviewed .
Ευχαριστίες για τα σχόλιά σας!