From: ndnenkov@... Date: 2017-03-27T13:20:09+00:00 Subject: [ruby-core:80377] [Ruby trunk Bug#13371] Syntax Error with regex when parens are omitted Issue #13371 has been reported by ndn (Nikola Nenkov). ---------------------------------------- Bug #13371: Syntax Error with regex when parens are omitted https://bugs.ruby-lang.org/issues/13371 * Author: ndn (Nikola Nenkov) * Status: Open * Priority: Normal * Assignee: * Target version: * ruby -v: 2.4.1 * Backport: 2.2: UNKNOWN, 2.3: UNKNOWN, 2.4: UNKNOWN ---------------------------------------- When you skip the parens of method invocations and pass a regex, you can get a `SyntaxError` if the regex starts with a space. ~~~ ruby ''.split(/ ./) # => [] ''.split /./ # => [] ''.split / ./ # !> SyntaxError: unexpected '.' ~~~ As per the syntax highlighting in my text editor and a discussion with another person, it seems that the opening slash is interpreted as division. Reproducible with older versions as well (tried it until 2.1.2) -- https://bugs.ruby-lang.org/ Unsubscribe: