Fix end constraint for regexp elimination (#2571)