title: Regular Expression for get attribute value
body: <p>I have used below code to get the regex but not working properly.. Please suggest..</p>
  
  <pre><code>&lt;?xml version='1.0'?&gt;
  &lt;root&gt;
  &lt;category cname='CH1' id='C1'&gt;
  &lt;subcat sname='SCName1' sid='SC1'&gt;
  </code></pre>
  
  <p>I want to get sname &amp; sid attributes value of SCName1 &amp; SC1. I've used below code</p>
  
  <pre><code>use File::Slurp;
  my $filename='nba.xml';
  my @lines = read_file( $filename ) ;
  foreach (@lines) {
    $_=~/sname\s*=\s*'([^']+)'.*?sid\s*=\s*'([^']+)'/g;
    print "$1,$2\n";
    $comp1="$1";
    $comp2="$2";
  }
  </code></pre>
  
  <p>Thanks in advance!!!!!!</p>