parsing

XXE safe XML parsing with external entity resolution disabled

XML is still a problem when parsers are left in permissive mode. I disable external entities, refuse network fetches, and prefer simpler formats unless XML is required by an external integration. Attackers love parser defaults that nobody revisited af

JSON encoding and decoding with Codable

Codable protocol combines Encodable and Decodable for seamless JSON conversion. Swift structs and classes conforming to Codable automatically synthesize encoding/decoding logic when all properties are Codable. JSONEncoder converts Swift types to JSON

nom for parser combinators and zero-copy parsing

Nom is a parser combinator library for building parsers from small, composable functions. It's byte-oriented and zero-copy, making it ideal for binary protocols, config files, or log parsing. I define parsers for tokens (like tag("GET") or digit1), th

Regular expressions for extracting structured entities from raw text

Regex is not glamorous, but it remains one of the fastest ways to turn messy text into useful structured fields. I use it for IDs, dates, codes, and log fragments before reaching for heavier NLP. The important part is making patterns specific enough t