title: Insert number into livesearch ReactJS
body: <p>I am working on my first app in ReactJS.
  As a beginner I ran into a problem.
  My app is phonebook so I have livesearch to display recommended data.
  For strings everything works well, but when I want to create option &quot;Search By Number&quot; my app dosen't work. So can you show me what and where should I do to resolve a problem. Problem is in wrong <strong>regEx</strong>?
  I try with this:   const pattern = /^[0-9\b]+$/ , <em>where should I put this?</em></p>
  <p><em>Thanks for your help!</em></p>
  <p>Error:
  TypeError: index.number.match is not a function
  (anonymous function)</p>
  <p>This is my code:</p>
  <pre><code>import React, {useState, useEffect} from 'react'
  import '../CSS/App.css';
  import axios from 'axios';
  
  export default function Number() {
      const [numberList, setNumberList] = useState([]);    
      const [text, setText] = useState(&quot;&quot;);
      const [suggestions, setSuggestions] = useState([]);
      const [showNumber, setShowNumber] = useState([]);
    
  
      useEffect(() =&gt; {
          const loadNumbers = async () =&gt; {
              const response = await axios.get(&quot;http://localhost:3001/numbers&quot;);
              setNumberList(response.data);
              
          };
          loadNumbers();         
          
      }, [])
      
   
      const onChangeHandler = (text) =&gt; {
          let matches = [];
          if (text.length &gt; 0 ) {
              matches = numberList.filter((index) =&gt; {               
                  const regex = new RegExp(`${(text)}`, &quot;gi&quot;);                
                  return index.number.match(regex);                
              })
              
          }
          console.log('matches', matches);
          setSuggestions(matches);
          setText(text);
                    
      }    
  }
  </code></pre>
  <p>And this is part of my API:  http://localhost:3001/numbers</p>
  <pre><code>{&quot;id&quot;:1,&quot;name&quot;:&quot;Voditelj&quot;,&quot;number&quot;:26327,&quot;visible&quot;:true,&quot;active&quot;:true,&quot;createdAt&quot;:&quot;2021-11-12T15:36:51.000Z&quot;,&quot;updatedAt&quot;:&quot;2021-11-12T15:36:51.000Z&quot;,&quot;DepartmentId&quot;:1,&quot;RegionId&quot;:1,&quot;Region&quot;:{&quot;id&quot;:1,&quot;regionTitle&quot;:&quot;Firule&quot;,&quot;createdAt&quot;:&quot;2021-10-29T10:11:40.000Z&quot;,&quot;updatedAt&quot;:&quot;2021-10-29T10:11:40.000Z&quot;},&quot;Department&quot;:{&quot;id&quot;:1,&quot;departmentTitle&quot;:&quot;Služba za informatiku&quot;,&quot;alias&quot;:&quot;INF&quot;,&quot;createdAt&quot;:&quot;2021-10-29T10:14:32.000Z&quot;,&quot;updatedAt&quot;:&quot;2021-10-29T10:14:32.000Z&quot;,&quot;RegionId&quot;:1}},{&quot;id&quot;:2,&quot;name&quot;:&quot;Voditelj&quot;,&quot;number&quot;:26333,&quot;visible&quot;:true,&quot;active&quot;:true,&quot;createdAt&quot;:&quot;2021-11-12T15:37:42.000Z&quot;,&quot;updatedAt&quot;:&quot;2021-11-12T15:37:42.000Z&quot;,&quot;DepartmentId&quot;:2,&quot;RegionId&quot;:1,&quot;Region&quot;:{&quot;id&quot;:1,&quot;regionTitle&quot;:&quot;Firule&quot;,&quot;createdAt&quot;:&quot;2021-10-29T10:11:40.000Z&quot;,&quot;updatedAt&quot;:&quot;2021-10-29T10:11:40.000Z&quot;},&quot;Department&quot;:{&quot;id&quot;:2,&quot;departmentTitle&quot;:&quot;Služba za tehničke poslove&quot;,&quot;alias&quot;:&quot;TEH&quot;,&quot;createdAt&quot;:&quot;2021-10-29T10:14:47.000Z&quot;,&quot;updatedAt&quot;:&quot;2021-10-29T10:14:47.000Z&quot;,&quot;RegionId&quot;:1}},{&quot;id&quot;:3,&quot;name&quot;:&quot;Voditelj&quot;,&quot;number&quot;:27333,&quot;visible&quot;:true,&quot;active&quot;:true,&quot;createdAt&quot;:&quot;2021-11-12T15:37:52.000Z&quot;,&quot;updatedAt&quot;:&quot;2021-11-12T15:37:52.000Z&quot;,&quot;DepartmentId&quot;:3,&quot;RegionId&quot;:2,&quot;Region&quot;:{&quot;id&quot;:2,&quot;regionTitle&quot;:&quot;Križine&quot;,&quot;createdAt&quot;:&quot;2021-10-29T10:11:46.000Z&quot;,&quot;updatedAt&quot;:&quot;2021-10-29T10:11:46.000Z&quot;},&quot;Department&quot;:{&quot;id&quot;:3,&quot;departmentTitle&quot;:&quot;Služba za tehničke poslove&quot;,&quot;alias&quot;:&quot;TEH&quot;,&quot;createdAt&quot;:&quot;2021-10-29T10:14:51.000Z&quot;,&quot;updatedAt&quot;:&quot;2021-10-29T12:20:43.000Z&quot;,&quot;RegionId&quot;:2}}
  </code></pre>