Help with a regular expression

Soldato
Joined
1 Mar 2003
Posts
5,508
Location
Cotham, Bristol
I'm wanting to scan through an xml file and store the names of tags I've found in a list

The xml tags take the format

PHP:
<tag:name param1="" param2=""></tag:name>

I'm just wanting to match the first part of the tag i.e. <tag:name

I've tried writing a re pattern which is

PHP:
tag_re = "([<]+)([^?]+)((?:[\s])$)"

But it doesn't return any matches, what have I done wrong?
 
But I don't know what x and y is, as I said I don't want the entire <tag:name param1="" param2=""> just <tag:name
 
Back
Top Bottom