Repository navigation
Set RegexReplace
external help file: ModernConveniences-help.xml Module Name: ModernConveniences online version: https://docs.microsoft.com/dotnet/standard/base-types/substitutions-in-regular-expressions schema: 2.0.0
Updates text found with Select-String, using a regular expression replacement template.
Set-RegexReplace [-Replacement] <String> [-InputObject <MatchInfo>] [-ProgressAction <ActionPreference>]
[<CommonParameters>]
{{ Fill in the Description }}
)' README.md |Set-RegexReplace "`$1 $(Get-Date) `$2"
Updates the generated date in README.md.
\d+</td>)' |Set-RegexReplace '$1 align="right"$2'
<table> <colgroup><col/><col/></colgroup> <tr><th>Name</th><th>Length</th></tr> <tr><td>README.md</td><td align="right">21099</td></tr> </table>
A regular expression replacement string.
- $$ is a literal $
- $_ is the entire input string.
- $` is the string before the match.
- $& is the entire matching string.
- $' is the string after the match.
- $1 is the first matching group.
- $n (where n is a number) is the nth matching group.
- $name is the group named "name".
- $+ is the last matching group.
Type: String
Parameter Sets: (All)
Aliases:
Required: True
Position: 1
Default value: None
Accept pipeline input: False
Accept wildcard characters: FalseThe output from Select-String.
Type: MatchInfo
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: True (ByValue)
Accept wildcard characters: False{{ Fill ProgressAction Description }}
Type: ActionPreference
Parameter Sets: (All)
Aliases: proga
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: FalseThis cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.
https://docs.microsoft.com/dotnet/standard/base-types/substitutions-in-regular-expressions