one parse error when run a powershell regex from userdata

asked 2015-04-24 06:00:32 +0300

celina-yang gravatar image

hello, I have one powershell script that I can run successfully directly from powershell command prompt. But when I try to run it from userdata, it always failed because of parse error: + $allsnapshot=$testcode1 -split "<a\s+" |="" select-string="" "(?&lt;="\&gt;" &lt;&lt;&lt;&lt;="" )(\d+)(.<="" p="">

*)SNAPSHOT(?=\/\<)" -allmatches | % { $.matches } | % { $.value } |get-uniqu

e |sort -descending

+ CategoryInfo          : ObjectNotFound: (?<=\>:String) [], CommandNotFou

ndException

+ FullyQualifiedErrorId : CommandNotFoundException

The script is: $allsnapshot=$testcode1 -split "<a\s+" |="" select-string="" "(?&lt;="\&gt;)(\d+)(.*)SNAPSHOT(?=\/\&lt;)"" -allmatches="" |="" %="" {="" $<em="">.matches } | % { $.value } |get-unique |sort -descending

I also tried single quotes but the same error. Could you pls tell me how to fix this?

Thanks a lot

edit retag flag offensive close merge delete

Comments

Hello, can you please paste the working script on http://paste.openstack.org/ or http://pastebin.com/? It is not working for me. Thanks.

ader1990 gravatar imageader1990 ( 2015-04-27 16:20:04 +0300 )edit