Skip to content

Select-String highlighting / emphasis only works on first Select-String #20062

@LeeHolmes

Description

@LeeHolmes

Prerequisites

Steps to reproduce

The highlighting / emphasis from Select-String is only done for the first instance of Select-String in the pipeline. It should be the last since it is a highlighting technique.

Expected behavior

PowerShell 7.3.6

[C:\Users\lee]
PS:1 > "Hello World" | Select-String Hello

>>Hello<< World


[C:\Users\lee]
PS:2 > "Hello World" | Select-String World

Hello >>World<<


[C:\Users\lee]
PS:3 > "Hello World" | Select-String Hello | Select-String World

Hello >>World<<


[C:\Users\lee]
PS:4 > "Hello World" | Select-String Hello -NoEmphasis | Select-String World

Hello >>World<<

Actual behavior

PowerShell 7.3.6

[C:\Users\lee]
PS:1 > "Hello World" | Select-String Hello

>>Hello<< World


[C:\Users\lee]
PS:2 > "Hello World" | Select-String World

Hello >>World<<


[C:\Users\lee]
PS:3 > "Hello World" | Select-String Hello | Select-String World

>>Hello<< World


[C:\Users\lee]
PS:4 > "Hello World" | Select-String Hello -NoEmphasis | Select-String World

Hello World
(no highlighting / emphasis at all)

Error details

No response

Environment data

Name                           Value
----                           -----
PSVersion                      7.3.6
PSEdition                      Core
GitCommitId                    7.3.6
OS                             Microsoft Windows 10.0.22000
Platform                       Win32NT
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0

Visuals

image

Metadata

Metadata

Assignees

No one assigned

    Labels

    Needs-TriageThe issue is new and needs to be triaged by a work group.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions