Swift doesn't do named capturing groups in regexp

But if you combine a swift enum with RegExp matches and add ($n ) to your capture groups you can simulate named capturing groups.

Example will come soon

from apple docs

The text of capture group n will be substituted for $n. n must be >= 0 and not greater than the number of capture groups. A $ not followed by a digit has no special meaning, and will appear in the substitution text as itself, a $.

  • try to get numbered capturing groups working. (You may need them for back referencing etc)