Regex Error Thread 1: EXC_BREAKPOINT (code=1, subcode=0x22a78b848)

I run into Thread 1: EXC_BREAKPOINT Error, This code should be right.

import Foundation
import RegexBuilder

let string = "https://swift.org, #swift, @swift"

let regex = Regex {
  ChoiceOf {
    OneOrMore(.url())
    WordWithPrefix(prefix: "@")
    WordWithPrefix(prefix: "#")
  }
}

struct WordWithPrefix: RegexComponent {
  let prefix: String

  @RegexComponentBuilder
  var regex: Regex<some RegexComponent> {
    prefix
    OneOrMore(.word)
  }
}

for match in string.matches(of: regex) { // Thread 1: EXC_BREAKPOINT (code=1, subcode=0x22a78b848)
  print(String(string[match.range]))
}
Answered by zunda in 725658022

This problem is not happened when run again.

Accepted Answer

This problem is not happened when run again.

Regex Error Thread 1: EXC_BREAKPOINT (code=1, subcode=0x22a78b848)
 
 
Q