title: Regular expression : extract text from middle of line
body: <p>I need to extract the text from below sample as follows - 
  Sample text - </p>
  
  <pre><code>Link speed type is OK, link duplex type is DOWN
  Unknown-speed mode, Link speed type is OK, Flow-control is disabled
  Link speed type is OK, link duplex type is DOWN, Flow-control is disabled
  </code></pre>
  
  <p>From this i want to extract the line starting with Link speed(It can be on start of line or in middle line) upto the Flow-Control...(this part can or cannot be present). </p>
  
  <p>So the desired output would be like this -</p>
  
  <pre><code>Link speed type is OK, link duplex type is DOWN
  Link speed type is OK
  Link speed type is OK, link duplex type is DOWN
  </code></pre>
  
  <p>means first and third line full and from second line only link speed part excluding comma and Flow-control part.. 
  I tried few ways.. </p>
  
  <pre><code>^\s*(?:.*,)?\s*(Link speed.*)
  </code></pre>
  
  <p>Problem - this selects 2nd line till the end. </p>
  
  <pre><code>^\s*(?:.*,)?\s*(Link speed.*(?=\W*Flow-control))
  </code></pre>
  
  <p>It does  not select the first line which does not have flow-control in it.</p>