From 60a4e2f84ea5ee044b9d7c8d254e2cde8b3e1e08 Mon Sep 17 00:00:00 2001 From: Alan Longstaff Date: Wed, 17 Mar 2021 22:32:04 +0000 Subject: [PATCH] Update New-HTMLText.ps1 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 #200 --- Public/New-HTMLText.ps1 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Public/New-HTMLText.ps1 b/Public/New-HTMLText.ps1 index 8ffb1f7a..d0a0b632 100644 --- a/Public/New-HTMLText.ps1 +++ b/Public/New-HTMLText.ps1 @@ -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) }