in reply to
RegEx Against Arbitrary XML Tags
GrandFather's answer is certainly the right way to go, but while we're here, let's look at your regular expression:
if($line =~ /^\s*<(\w+)>[^\w*|\d*|<]/)
Breaking it down:
- Anchor the start, zero or more spaces
- One or more word-characters in <> (so far so good)
- A single character ([..] is a character class) which is not (^) a word character, (\w), an asterisk (*), a pipe (|) or a less-than sign (<). Note that \d is included under \w.
I'm not quite sure what you wanted at the end there, but parens ((...|...)) are probably closer than a character class ().