title: Ruby: How to parse a string to pull something out and assign it to a variable
body: <p>I have a string that looks something like this:</p>
  
  <pre><code>"my name is: andrew"
  </code></pre>
  
  <p>I'd like to parse the string, pull out the name from the string, and assign it to a variable. How would I do this with Ruby?</p>
  
  <p><strong>Update:</strong></p>
  
  <p>The string I used as an example was only an example. The strings that I will be working with can change formats, so you can't rely on the colon being in the actual example. Here are a few examples that I'm working with:</p>
  
  <pre><code>"/nick andrew"     # command: nick, value: "andrew"
  "/join developers" # command: join, value: "developers"
  "/leave"           # command: leave, value: nil
  </code></pre>
  
  <p>I'd like to use some sort of regular expression to solve this (since the string can change formats), rather than splitting the string on certain characters or relying on a certain character position number.</p>