I am trying to match mathematica expressions like `1+2` and `1*2/3....` to infinity. Can someone explain why my regex matches the final case below, and how to fix it so that it matches only valid expressions (that might stretch forever)?

```
perms=["12+2*4","2+2","-2+","12+34-"]
perms.each do |line|
    puts "#{line}=#{eval(line)}" if line =~ /^\d+([+-\/*]\d+){1,}/
end

```

I expected the output to be:

```
12+2*4=20
2+2=4

```