title: Pull number value from string
body: <p>So I need to pull a number value from a string.  I currently have a working solution but I feel that maybe I can improve this using a regular expression or something.</p>
  
  <p>Here is my working solution</p>
  
  <pre><code>var subject = "This is a test message [REF: 2323232]";
  
  if(subject.indexOf("[REF: ") &gt; -1){
    var startIndex = subject.indexOf("[REF: ");
    var result = subject.substring(startIndex);
    var indexOfLastBrace = result.indexOf("]");
    var IndexOfRef = result.indexOf("[REF: ");
    var ticketNumber = result.substring(IndexOfRef + 6, indexOfLastBrace);
  
    if(!isNaN(ticketNumber)){
      console.log("The ticket number is " + ticketNumber)
      console.log("Valid ticket number");
    }
    else{
      console.log("Invalid ticket number");
    }
  }
  </code></pre>
  
  <p>As you can see I'm trying to pull the number value from after the "[REF: " string.  </p>