Community Patterns

Community Library Entry

1

Regular Expression
Created·2021-04-17 09:35
Flavor·Python

r"
%(?P<flags>[-+ #0]*)(?P<width>\d+|\*)?(?:\.(?P<precision>\d+|\*))?(?P<length>hh|h|l|ll|j|z|t|L|I64)?(?P<specifier>[%csdioxXufFeEaAgGnp])
"
gm
Open regex in editor

Description

Parses printf conversion specifications.

This version detects multiple flags and (space) flag. MSVC length modifier I64 is also supported.

I'm using this regex in my Python project, so please change accordingly if you use other flavor of regex.

Submitted by Haruka Ma