I have an xml
file, ignore the numbers at the start, that's not part of it.
(1)<?xml version="1.0" encoding="UTF-8"?>
(2)<one>
(3)<x> </x>
(4)</one><look> HERE </look> <find> 123 </find> <some> </some>
(5)<two></two>
I know there is a line that has a <look> HERE </look>
tag, and I want to be able to find the value located within the <find>
tags (in this case 123
), which is on the same line.
Get-Content '.\x.xml' # works
$line = $x -match "<look> HERE </look>" # this returns the entire line (line 4 in this case)
$line -match "<find>(?<content>.*)</find>"
$matches['content'] #cannot index into a null array error
Why? I expect to get 123
returned