Project

General

Profile

Actions

Feature #8714

open

Non-interpolated regular expression literal

Added by phluid61 (Matthew Kerwin) almost 11 years ago. Updated almost 11 years ago.

Status:
Open
Assignee:
-
Target version:
-
[ruby-core:56285]

Description

=begin

I propose a new %string for non-interpolated regexp literals: %R

It is common to see erroneous bug reports around the use of ((%#%)) in regexp literals, for example where (({/[$#]/})) raises a syntax error "unexpected $undefined", and this confuses people. The only solution is to rearrange the regular expression (such as (({/[$#]/}))), which is not always desirable.

An non-interpolated regexp, such as (({%R/[$#]/})), would allow a much simpler resolution.

=== Known Issues

  • the capitalisation is the opposite of %Q(interpolated) and %q(uninterpolated)
  • %R was also proposed for literal Rationals in #8430, although I believe this has been superseded by the (({1.2r})) syntax

=end

Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0Like0Like0Like0Like0Like0