one parse error when run a powershell regex from userdata
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="" "(?<="\>" <<<<="" )(\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="" "(?<="\>)(\d+)(.*)SNAPSHOT(?=\/\<)"" -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
Hello, can you please paste the working script on http://paste.openstack.org/ or http://pastebin.com/? It is not working for me. Thanks.