Skip to main content
3 of 4
added 67 characters in body; added 111 characters in body
leppie
  • 117.6k
  • 18
  • 201
  • 300
@"\{\s*(?<field>\w+)\s*(,\s*(?<width>\d*)\s*)?\}" 

Usage: Use Regex.Matches and extract the groups from each

Edit: You could add the static text in the expression too, but that would make it 'harder' to read IMO.

Tip: Learn Regex, it's fun :)

leppie
  • 117.6k
  • 18
  • 201
  • 300