Strange bug doesn't work for certain operators

I have finished my code for the calculator using React but i get a strange bug, can someone help me debug it? Follow the steps:

  1. Press 0
  2. Press either * or +
    the code doesnt add them but adds all the others like - % . / i dont understand why it happens only for the above 2 buttons

Here’s a hint: accepts a regex as an argument. What kind of value are you passing to search? If that value is interpreted as a regex, would that explain why * and + would behave unexpectedly?

Thanks a lot, that helped it