I'm looking for a regex to match here strings in PowerShell @'...'@ and @"..."@ are here strings
Rules:
- Always new line is followed after start(
@'or@") - There's no character after end (
'@or"@), it always is at the line start, however more text can follow it up - The outer
@' .. '@may include an inner@" "@but in this case the outer will be matched.
Examples
- Example where outer (including
hello) will be matched
$MyString = @"
hello
@'
'@
bye
"@
- Other example where outer (including
hello) will be matched
$MyString = @'
hello
@"
"@
bye
'@
- Example from Microsoft
$page = [XML] @"
<command:command xmlns:maml="http://schemas.microsoft.com/maml/2004/10"
xmlns:command="http://schemas.microsoft.com/maml/dev/command/2004/10"
xmlns:dev="http://schemas.microsoft.com/maml/dev/2004/10">
<command:details>
<command:name>
Format-Table
</command:name>
<maml:description>
<maml:para>Formats the output as a table.</maml:para>
</maml:description>
<command:verb>format</command:verb>
<command:noun>table</command:noun>
<dev:version></dev:version>
</command:details>
...
</command:command>
"@
I'd appreciate any help. I'm trying solve inlining for better PowerShell templating support to privacy.sexy so your help will be scaled to more in community.