I want to get "localhost" (or whatever text) inside this string:
XML-Execute-Result: <host>localhost</host>
I want a general method, like a way to reuse an expression value (like with sed in linux)
sed 's/*[0-9]$/\$&/'
Thank you very much for any reply
$text = "XML-Execute-Result: <host>localhost</host>"
if ($text -match "\<host\>(?<host>.*?)\</host\>")
{
$myhost = $matches.host
}
PS> if ($text -match "<host>(.*?)</host>") {$matches[1]}
localhost
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.