title: Changing tag's properties of HTML file
body: <p>I am struggling with the regular expression in Powershell. I have to put <code>alt</code> property to each <code>img</code> tag in an <code>html</code> file. What I did is, I tried to find the <code>img</code> tag and replace the content of the tag with modified content by using regular expression. Here is my code:     </p>
  
  <pre><code>$rowFile = Get-Content $file
  $regex = ".+&lt;img(.*?.+?)/&gt;"
  $regAlt = ".+ alt="
  $newFile = ""
  foreach($line in $rowFile){
      if($line -match $regex) { 
          if($line -notmatch $regAlt){
              $replaceValue = [string]$matches[1] + " alt=`"" + (Get-Random -input $altValues) + "`""
              $line = $line -replace [string]$matches[1], $replaceValue
          }
      }
      $newFile += [string]$line + "'n"
  }
  Set-Content -Path $file -Value $newFile
  </code></pre>
  
  <p>It works for general form of the tags like <code>&lt;img src="../../Content/images/Delete_Row.png" class="size-20_20" /&gt;</code>. But, doesn't work for the tags having angular stuffs or we can say the braceses. </p>
  
  <p>For example, <code>&lt;img data-ng-src="{{vm.getDashBoardImagePath(menu.menuDescription)}}" /&gt;</code> and <code>&lt;img class="size-20_20" src="../../Content/images/Edit_Row.png" data-ng-click="vm.editLabtest(test.labTestID)" /&gt;</code>.    </p>
  
  <p>Can anybody suggest me some solution to this problem?</p>