Skip to content

Convert-PSWildcardToRegex

SYNOPSIS

Converts a Powershell wildcard string to a regex string

SYNTAX

Convert-PSWildcardToRegex [[-String] <String>] [-ProgressAction <ActionPreference>] [<CommonParameters>]

DESCRIPTION

Converts a Powershell wildcard string to a regex string. This is necessary because the Netbox API uses regex for its search parameters.

EXAMPLES

EXAMPLE 1

Convert-PSWildcardToRegex -String 'abc*'
Returns '^abc.*$'

EXAMPLE 2

Convert-PSWildcardToRegex -String 'a[bc]?'
Returns '^a[bc].$'

PARAMETERS

-String

The Powershell wildcard string to convert to regex.

Type: String
Parameter Sets: (All)
Aliases:

Required: False
Position: 1
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-ProgressAction

{{ Fill ProgressAction Description }}

Type: ActionPreference
Parameter Sets: (All)
Aliases: proga

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

CommonParameters

This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.

INPUTS

OUTPUTS

[string] The converted regex string.

NOTES

Common parameters

common request params