SE-0354 (Second Review): Regex Literals

Based on the discussion so far, here is where I stand now:

  • +1 on single line literal as proposed (with possible further refinements to reduce the chance of ambiguity), including its extended #/.../# format.

  • -1 on using the same #/.../# delimiter for multi-line literals. It is too different to use the same delimiter.

  • +1 on keeping multi-line literals.

Also I would:

  • Provide the ability to specify global semantic and syntactic options at the beginning of multiple-line literal.

  • Have defaults that are sensible for multiple-line complex literals and accept those defaults being different from the single-line literals.

  • Provide the ability to have end of line Swift comment on the fist line (opening delimiter of the literal) such as:

    let complexMatch = #///[options here]          // Swift end of line comment here
           the actual literal
    ///#
3 Likes