title: Removing white space from the beginning using regular expression in PHP
body: <p>I'm trying to get the data from a website using php curl. From the output, I need to neglect all the white spaces and empty lines. I used some regex. I'm really not familiar with Regex.</p>
  
  <p>Please help me solve this problem.</p>
  
  <p>There is my code:</p>
  
  <pre><code>if(preg_match('/&lt;div class="search-results-details-body"&gt;(.*?) &lt;div class="search-results-details-footer"&gt;/s', $result, $output))
  {
      $stripped_result = ltrim(strip_tags($output[1]));
      $refined_output = str_replace('  ','',$stripped_result); 
      $regex = preg_replace('[\n\n]', "\n", $refined_output);  exit();
  }
  </code></pre>
  
  <p>and this is my output in order:</p>
  
  <pre><code> Requirements
    Minimum 2 years of web development experience is required
    Experience with PHP, MySQL, HTML, CSS, and JavaScript are preferred
    Bachelors Degree in Computer Science or related field
    Full knowledge and experience of software development lifecycle
    Strong organisational and analytical skills
    Ability to work under pressure to meet deadlines and required quality standards
    Ability to multi-task and prioritize responsibilities
    Excellent oral and written communication skills
  </code></pre>
  
  <p>here i want to remove all the starting white spaces.
  i need to get the output like this :</p>
  
  <pre><code>  Requirements
    Minimum 2 years of web development experience is required
    Experience with PHP, MySQL, HTML, CSS, and JavaScript are preferred
    Bachelors Degree in Computer Science or related field
    Full knowledge and experience of software development lifecycle
    Strong organisational and analytical skills
    Ability to work under pressure to meet deadlines and required quality standards
    Ability to multi-task and prioritize responsibilities
    Excellent oral and written communication skills
  </code></pre>
  
  <p>Please suggest a good solution</p>
  
  <p>Thank you</p>