powershell - Extract string using regex trouble with ending -


attempting extract status value below string ($data) using regex. trouble specifying end of value.

$data = "<?xml version="1.0" encoding="utf-8"?><bi:element xml:bi="http://www.bi.com/1.0.0" status="www.google.com/path/file.ext" version="2.0" xml:pa="http://www.pa.com/1.1.1" ...>  // attempt #1 $data -match "status='"(.*)'"" // $matches[1] contains www.google.com/path/file.ext" version="2.0" xml:pa="http://www.pa.com/1.1.1" ...>  // attempt #2 $data -match "status='"(.*)'" " // $matches[1] contains www.google.com/path/file.ext" version="2.0" xml:pa="http://www.pa.com/1.1.1" ...>  // attempt #3 $data -match "status='"(.*)'" v" // $matches[1] contains www.google.com/path/file.ext 

why not first attempt work? not want use third , working example because relies on order of attribute. better solution?

try matching non-quotes:

$data -match "status='"[^']*"" 

Comments

Popular posts from this blog

Android : Making Listview full screen -

javascript - Parse JSON from the body of the POST -

javascript - How to Hide Date Menu from Datepicker in yii2 -