fix wrong regexp and replace variable to array