title: What is the best way to split the string in typescript
body: <p>I have the string input something like</p>
  
  <p><strong>Input</strong>
  text: string = "today lunch 200 #hotelname"</p>
  
  <p><strong>Output</strong>
  subject: "today lunch"
  price: 200
  tag: #hotelname</p>
  
  <p>my solution is </p>
  
  <pre><code>text: string = "today lunch 200 #hotelname"
    tag: string;
    price: string;
    subject: string;
  
   this.text.forEach(x =&gt; {
        if(this.reg.test(x)){
           this.tag= x;
        }else if(parseInt(x)){
            this.price = x;
        }
        else{
          this.subject= x;
        }
      });
   console.log(this.subject, this.tag, this.price);
  </code></pre>
  
  <p>but the problem is my solution is not satisfying all test cases is there any better solution using typescript or in javascript</p>
  
  <p><strong>Test case</strong></p>
  
  <ol>
  <li>the string cannot have two no<br>
  ex 1: today lunch 200 #hotel 200<br>
  ex 2: 200 food 2 0 1 #pasta  </li>
  <li>The text starts with # is treated as tag and cant have multiple tags in a<br>
  string </li>
  <li>if the string is like "food at xyz hotel 100 #chinies<br>
  output: subject: "food at xyz hotel"
          price: 100
          tag: #chinies</li>
  </ol>