Write-Output "?[^```n`r\(]" result

37 views
Skip to first unread message

Miron

unread,
Mar 28, 2016, 2:20:01 PM3/28/16
to Pash Project
Hello Pash devs.

I am trying something very simple ( so it seems to me )

Write-Output "?[^```n`r\(]"

on AWS box.

The output reads \(]``n

On my Windows 7 machine with $PSVersionTable.PSVersion 4.0 the same command output reads

?[^`
\(]

which is I believe the expected one.

It would be very nice if you could please take a look. It makes my work with regular expressions a bit complicated. If you know easy workaround, please share.

Miron

unread,
Mar 28, 2016, 2:35:42 PM3/28/16
to Pash Project
To add, when using

$output = Write-Output "?[^```n`r\(]";
$output.toCharArray();

 On AWS ( using Pash ) output reads ( with edit for carriage return character ):
?
[
^
`
`
n

\
(
]

On Windows ( using Powershell 4.0 ) output reads ( with edits for new line / carriage return characters ):
?
[
^
`



\
(
]

I guess to get precise output I need to use something like screenshots. Basically, if I have to give precise verbose description, the new line character `n seems to be resolved to just charater "n".

I guess I am paranoid to give good descriptions :)

Miron

unread,
Mar 28, 2016, 2:39:39 PM3/28/16
to Pash Project
regarding workarounds, this works:

$output = Write-Output ( "?[^``{0}{0}{0}`r\(]" -f "`n" ) 

I guess with workaround it's just a convenience. May be there is something quirky going on, worth checking? Will mark as completed.

Friedrich von Never

unread,
Mar 28, 2016, 11:33:11 PM3/28/16
to Pash Project
Thanks for the report. I think this issue has been fixed in our master branch: https://github.com/Pash-Project/Pash/pull/417

Johannes Rössel

unread,
Mar 29, 2016, 10:40:34 AM3/29/16
to pash-p...@googlegroups.com
Hello Miron,

> $output = Write-Output ( "?[^``{0}{0}{0}`r\(]" -f "`n" )
>
> I guess with workaround it's just a convenience. May be there is something
> quirky going on, worth checking? Will mark as completed.

I could reproduce the problem here (by the way, Write-Output does
nothing in your case, you can just as well use the operand directly).

It seems like something is going wrong in
StringExpressionHelper.ResolveEscapeCharacters. At least that's as far
as my debugging led me for now.

Regards,
Johannes

Reply all
Reply to author
Forward
0 new messages