Powershell - print only text between quotes?

后端 未结 3 1882
孤城傲影
孤城傲影 2021-01-21 17:45

How can I have the output of the following text only show the text in the quotes (without the quotes)?

Sample text\"

this is an \"apple\". it is red
this         


        
3条回答
  •  时光说笑
    2021-01-21 18:03

    Just another way using regex:

    appcmd list apppool | % { [regex]::match( $_ , '(?<=")(.+)(?=")' ) } | select -expa value
    

    or

     appcmd list apppool | % { ([regex]::match( $_ , '(?<=")(.+)(?=")' )).value }
    

提交回复
热议问题