Community Patterns

Community Library Entry

0

Regular Expression
Created·2020-04-13 16:41
Flavor·Golang

`
%(?P<flag>\#|\+|\-| |0)?((?P<width>[1-9])\.(?P<precision>[1-9])|(?P<widthDefaultPrecision>[1-9])|(?P<widthZeroPrecison>[1-9])\.|\.(?P<precisionDefaultWidth>[1-9]))?(?P<verb>\w{1,9})
`
gm
Open regex in editor

Description

Can be used to find all of the verbs in a golang format string. It will correctly extract verbs that would otherwise be specified by fmt.Sprintf, including their flags, width and precision.

You can test it out on the fmt documentation, here: https://golang.org/pkg/fmt/

Submitted by anonymous