Skip to content

Commit

Permalink
fixes link urls when multiple rounded brackets are used
Browse files Browse the repository at this point in the history
fixes link urls when multiple rounded brackets are used
fixes EvotecIT#200
  • Loading branch information
grueni authored Oct 6, 2023
1 parent 7f8a7f7 commit 6b0ebf3
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions Public/New-HTMLText.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,8 @@ function New-HTMLText {
if ($FindMe) {
foreach ($find in $FindMe) {
$LinkName = ([regex]::Match($Find.value, "[^\[]+(?=\])")).Value
$LinkURL = ([regex]::Match($Find.value, "(?<=\().+(?=\))")).Value
$res = [regex]::Matches($Find.value, "\(([^)]+)\)")
$LinkURL = $res.captures.groups[$res.captures.groups.count-1].Value
$Link = New-HTMLAnchor -HrefLink $LinkURL -Text $LinkName
$Text[$i] = $Text[$i].Replace($find.value, $Link)
}
Expand Down Expand Up @@ -333,4 +334,4 @@ function New-HTMLText {
}

Register-ArgumentCompleter -CommandName New-HTMLText -ParameterName Color -ScriptBlock $Script:ScriptBlockColors
Register-ArgumentCompleter -CommandName New-HTMLText -ParameterName BackgroundColor -ScriptBlock $Script:ScriptBlockColors
Register-ArgumentCompleter -CommandName New-HTMLText -ParameterName BackgroundColor -ScriptBlock $Script:ScriptBlockColors

0 comments on commit 6b0ebf3

Please sign in to comment.