XML is notoriously difficult to parse with regular expressions... The packages are really the way to go, even if it seems like a lot of effort — even political effort if your admin is an adversary or something. I wouldn't be surprised at all if one of the many XML choices are core by now, although I haven't checked recently.
Otherwise, based on that data, it looks like it aughta match. Are you sure the data in $x looks how you think it looks?