swift-regex-builder

Construct and parse type-safe Swift regular expressions with RegexBuilder.

4|1|Updated Apr 2, 2026
One-click install
npx skills add https://github.com/AutisticAF/claude-code-apple-dev-plugin --skill swift-regex-builder
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: swift-regex-builder
Source: https://github.com/AutisticAF/claude-code-apple-dev-plugin/tree/main/skills/swift-regex-builder
Command: npx skills add https://github.com/AutisticAF/claude-code-apple-dev-plugin --skill swift-regex-builder

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This skill helps developers replace fragile, string-based regular expressions with Swift's type-safe Regex and RegexBuilder APIs to reliably match, extract, replace, and parse structured data from strings.

Core Features & Use Cases

  • Readable, composable patterns for building multi-line and complex regex with RegexBuilder instead of concatenating strings.
  • Captures and transforms to extract typed values including integers, doubles, and dates using Foundation parsers.
  • Migration guidance for moving from NSRegularExpression to modern Swift regex in projects targeting iOS 16 / macOS 13 and newer.

Quick Start

Use the swift-regex-builder skill to generate a RegexBuilder pattern that extracts a date and an integer amount from the string "Due: 2025-12-31 $1,234".

Frequently Asked Questions about swift-regex-builder

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I build type-safe regex patterns in Swift to extract structured data?

Type-safe regex patterns in Swift use the RegexBuilder DSL to compose readable patterns, allowing you to match and extract structured data from strings without fragile string concatenation. This approach leverages Swift's type system for reliable parsing.

How do I migrate from NSRegularExpression to modern Swift regex?

Migrating from NSRegularExpression to modern Swift regex involves replacing string-based patterns with Regex literals or the RegexBuilder DSL. This skill provides migration guidance to transition projects targeting iOS 16, macOS 13, tvOS, and visionOS to type-safe regex APIs.

Can I extract typed values like dates and integers using Swift RegexBuilder?

Yes, Swift RegexBuilder captures and transforms typed values including integers, doubles, and dates. By applying Foundation parsers directly within your regex pattern, you extract strongly typed data from matched strings instead of receiving raw string captures.

What is the RegexBuilder DSL and how does it differ from regex literals?

The RegexBuilder DSL provides readable, composable components for building multi-line and complex regex patterns programmatically, whereas regex literals use standard string syntax. Both achieve type-safe string processing in Swift 5.7+ projects.

Does Swift regex support quantifiers, character classes, and anchors?

Yes, Swift regex supports quantifiers, character classes, and anchors. You can use these standard regular expression features within both regex literals and the RegexBuilder DSL to precisely define string matching boundaries and repetition logic.

What are the limitations of using Swift RegexBuilder for string parsing?

Swift RegexBuilder is limited to projects targeting iOS 16, macOS 13, tvOS, and visionOS or newer. It requires Swift 5.7+ and cannot be applied to older deployment targets that still rely on NSRegularExpression for string parsing tasks.