What is a good general regex (in PHP terms) to determine if a string is a valid XML tag name?
I startet using /[^>]+/i but that also matches something like 4 \<< which obviously isn’t a valid tag name.
So I tried combining all valid characters like /[a-z][a-z0-9_-]*/i which also isn’t quite right, as XML allows virtually any character in tag names also of foreign languages.
I’m stuck on that now – should I just check if there are whitespace characters? Or is there more to it?
why dont you just use an XML parser/generator which already knows the rules?