PowerShell: Here-String
What is Here-String
Here-string (aka heredoc) is a syntax for quoting long multi-lines text. There are two syntaxes.
- APOSTROPHE delimiter → literal.
- QUOTATION MARK delimiter → $ variable or expression expanded.
APOSTROPHE delimiter
$x = @' long string here. everything is literal variable $n are not intepreted can contain many quotes "" '' tick ` or slashes / \ '@
QUOTATION MARK delimiter
$x = @" long string here may have multiple lines some variable $n cats can contain many quotes "" '' tick ` or slashes / \ "@
The beginning and end quotation syntax must be on their own lines.
PowerShell, string and regular expression
- PowerShell: String
- PowerShell: Single Quoted String
- PowerShell: Double Quoted String
- PowerShell: Here-String
- PowerShell: Escape Characters
- PowerShell: String Length
- PowerShell: Join String
- PowerShell: Split String
- PowerShell: Format String
- PowerShell: String Methods
- PowerShell: String Wildcards
- PowerShell: Regular Expression Operators
- PowerShell: Regex Result ($Matches)
- PowerShell: Regular Expression Syntax