title: Javascript - catch name in variable string
body: <p>I'm trying to catch a person's name. The name would be entered in a text box such as:</p>
  <p>my name is Robert or yes my name is Robert etc.</p>
  <p>I don't know where the actual name will fall however because of intro words etc.</p>
  <p>I was thinking something like this.</p>
  <ol>
  <li>I search for &quot;my name is&quot;</li>
  <li>I capture it in an array</li>
  <li>I split the array</li>
  <li>I now know the actual name follows as such:</li>
  </ol>
  <blockquote>
  <p><code>namesParts[0]</code> - would be &quot;my&quot;</p>
  <p><code>namesParts[1]</code> - would be &quot;name&quot;</p>
  <p><code>namesParts[2]</code> - would be &quot;is&quot;</p>
  <p><code>namesParts[3]</code> - would be the name i'm looking for.</p>
  </blockquote>
  <p>Something perhaps like the below but this doesn't work.</p>
  <pre><code>if (input.search(&quot;my name is&quot;)!= -1) {
      var names = input.match(/my name is/);
      var namesParts = names.split(' '); 
      var one = namesParts[3];
      document.result.result.value = &quot;Ok your name is &quot;+one+&quot;.&quot;;
      return true;
  }
  </code></pre>