title: How to extract a specific text from the string variable in scala
body: <p>I am new to Spark scala world and trying to learn it. I have a variable containing following value.</p>
  
  <pre><code>val result = "Scan value: 1802 seconds
  Start time: Thu, Jan 31 2019, 15:09:09 GMT
  End time: Thu, Jan 31 2019, 15:39:11 GMT"
  </code></pre>
  
  <p>I want to read scan value which is 1802 seconds and start time and End Time to different variables.</p>
  
  <p>I am trying to use substring but I am not getting the results properly and the position may very the way the user enters.</p>
  
  <p>For example: To read scan value, I am doing as follows. But some times these position might change based on how user enters in the system. </p>
  
  <pre><code>val scan_value = result.sbstring(13,4)
  </code></pre>
  
  <p>Could anyone please help me on how to read these values into separate variables in scala.</p>
  
  <p>Thanks,
  Babu </p>