diff --git a/eng/common/scripts/update-docs-metadata.ps1 b/eng/common/scripts/update-docs-metadata.ps1 index 7cf65fa7d2a4..34aa42801ec0 100644 --- a/eng/common/scripts/update-docs-metadata.ps1 +++ b/eng/common/scripts/update-docs-metadata.ps1 @@ -73,16 +73,13 @@ function GetAdjustedReadmeContent($pkgInfo, $lang){ $foundTitle = "" # only replace the version if the formatted header can be found - $headerContentMatches = (Select-String -InputObject $pkgInfo.ReadmeContent -Pattern 'Azure .+? (client|plugin|shared) library for (JavaScript|Java|Python|\.NET|C)') - if ($headerContentMatches) { - $foundTitle = $headerContentMatches.Matches[0] - $fileContent = $pkgInfo.ReadmeContent -replace $foundTitle, "$foundTitle - Version $($pkgInfo.PackageVersion) `n" - - # Replace github master link with release tag. - $ReplacementPattern = "`${1}$($pkgInfo.Tag)" - $fileContent = $fileContent -replace $releaseReplaceRegex, $ReplacementPattern - } - + $titleRegex = "(\# Azure .+? (?:client|plugin|shared) library for (?:JavaScript|Java|Python|\.NET|C))" + $fileContent = $pkgInfo.ReadmeContent -replace $titleRegex, "`${1} - Version $($pkgInfo.PackageVersion) `n" + + # Replace github master link with release tag. + $ReplacementPattern = "`${1}$($pkgInfo.Tag)" + $fileContent = $fileContent -replace $releaseReplaceRegex, $ReplacementPattern + $header = "---`ntitle: $foundTitle`nkeywords: Azure, $lang, SDK, API, $($pkgInfo.PackageId), $service`nauthor: maggiepint`nms.author: magpint`nms.date: $date`nms.topic: article`nms.prod: azure`nms.technology: azure`nms.devlang: $lang`nms.service: $service`n---`n" if ($fileContent) {