Skip to content

Commit

Permalink
Adding ?<Markdown_Link> (Fixes #117)
Browse files Browse the repository at this point in the history
  • Loading branch information
James Brundage committed Sep 5, 2022
1 parent e4a1f6e commit 3381b8e
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions RegEx/Markdown/Link.regex.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<#
.SYNOPSIS
Matches a Markdown Link
.DESCRIPTION
Matches a Markdown Link. Can customize the link text and link url.
.NOTES
This only matches simple markdown links. It does not currently match links with titles.
#>
param(
# The text of the link.
$LinkText = '[^\]\r\n]+',

# The link URI.
[Alias('LinkUrl')]
$LinkUri = '[^\)\r\n]+'
)

@"
(?<IsImage>\!)? # If there is an exclamation point, then it is an image link
\[ # Markdown links start with a bracket
(?<Text>$LinkText)
\] # anything until the end bracket is the link text.
\( # The link uri is within parenthesis
(?<Uri>$LinkUri)
\) # anything until the closing parenthesis is the link uri.
"@

0 comments on commit 3381b8e

Please sign in to comment.