InsideSingleBacktick

The InsideSingleBacktick() static method returns a pattern for finding the value wrapped in backticks in another string.

Overloads

InsideSingleBacktick(string)
Returns a pattern for finding the value wrapped in backticks in another string.

InsideSingleBacktick(string)

Returns a pattern for finding the value wrapped in backticks in another string. It’s a convenient way to reuse another regular expression to see if it’s inside inline code.

InsideSingleBacktick([string]$InnerPattern)

Parameters

InnerPattern

A string representing the desired regular expression to find within a pair of backticks. To use this with an exact match, use the regex Escape static method to escape the string before using it as input to this method.

Returns

A string representing a regular expression for testing if the given pattern is nested inside backticks (`).

Exceptions

None.

Examples

The following example demonstrates checking whether a given pattern is discovered inside backticks in a line of text.

$Text = 'This is `some+thing` to find.'
$Pattern = "some+thing"

$Text -match [ParsingPatterns]::InsideSingleBacktick($Pattern)

$Text -match [ParsingPatterns]::InsideSingleBacktick([regex]::Escape($Pattern))

$Matches
False

True

Name                           Value
----                           -----
0                              `some+thing`