Reputation: 8834
In Ruby 1.8.7 the following regex warning: nested repeat operator + and * was replaced with '*'.
^(\w+\.\w+)\|(\w+\.\w+)\n+*$
It does work in Ruby 2.0 though?
http://rubular.com/r/nRUSP5LNZA
Upvotes: 0
Views: 112
Reputation: 168209
A nested operator works, but is warned because it is useless. \n+*
means:
\n
which is equivalent to a more simple expression \n*
, which means:
\n
There is no reason to use \n+*
. Ruby regex engine was replaced in Ruby 1.9 and in Ruby 2.0, and if there are any differences, then it is simply that the newer engine does not check for warnings as the older one did.
Upvotes: 3