Project

General

Profile

Actions

Bug #22554

closed

/o is ignored for interpolated regexp in condition predicates

Bug #22554: /o is ignored for interpolated regexp in condition predicates

Added by kddnewton (Kevin Newton) 6 days ago. Updated 6 days ago.

Status:
Closed
Assignee:
-
Target version:
-
[ruby-core:127500]

Description

$_ = "a"
count = 0

2.times do
  if /#{count += 1; "a"}/o
  end
end

p count # => expected 1, actual 2

as opposed to:

$_ = "a"
count = 0

2.times do
  /#{count += 1; "a"}/o =~ $_
end

p count # => expected 1, actual 1

It's both compilers.

Updated by kddnewton (Kevin Newton) 6 days ago Actions #1

  • Status changed from Open to Closed

Applied in changeset git|3eb1f25fc5263521be6ce4cc463f7ae307ba085b.


Honor /o flag in interpolated regexp in condition

[Bug #22554]

Actions

Also available in: PDF Atom