Skip to content

Commit

Permalink
Update New-HTMLText.ps1
Browse files Browse the repository at this point in the history
Removed ")" exclusion from $FindMe - any string in [text](url) format should now match, regardless of number of brackets in url.

No longer require lazy matching for $LinkURL - it should always end in ")" which can then be excluded.

Should fix EvotecIT#200
  • Loading branch information
Alan Longstaff committed Mar 17, 2021
1 parent cb68a01 commit 60a4e2f
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions Public/New-HTMLText.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -137,11 +137,11 @@ function New-HTMLText {

$newSpanTextSplat.LineBreak = $LineBreak
New-HTMLSpanStyle @newSpanTextSplat {
$FindMe = [regex]::Matches($Text[$i], "\[[^\]]+\]\([^)]+\)")
$FindMe = [regex]::Matches($Text[$i], "\[[^\]]+\]\(\S+\)")
if ($FindMe) {
foreach ($find in $FindMe) {
$LinkName = ([regex]::Match($Find.value, "[^\[]+(?=\])")).Value
$LinkURL = ([regex]::Match($Find.value, "(?<=\().+?(?=\))")).Value
$LinkURL = ([regex]::Match($Find.value, "(?<=\().+(?=\))")).Value
$Link = New-HTMLAnchor -HrefLink $LinkURL -Text $LinkName
$Text[$i] = $Text[$i].Replace($find.value, $Link)
}
Expand Down

0 comments on commit 60a4e2f

Please sign in to comment.