New Question

Revision history [back]

click to hide/show revision 1
initial version

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="" "(?&lt;="\&gt;" &lt;&lt;&lt;&lt;="" )(\d+)(.<="" p="">

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

e |sort -descending

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


+ 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