XML::RegExp(3)

πŸ’… NAME πŸ’…

okay so bestie, welcome to XML::RegExp β€” it's the perl module that hands you regular expressions for XML tokens. that's the whole vibe. it's giving "tiny module, big jobs." πŸŽ€


✨ SYNOPSIS ✨

like, here's the entire use case and honestly it ate:

use XML::RegExp;

if ($my_name =~ /^$XML::RegExp::Name$/)
{
  # $my_name is a valid XML 'Name'
}

that's it. that's the whole flex. you drop the variable in, it tells you if your string is a legit XML Name, no cap. πŸ’–


🌸 DESCRIPTION 🌸

so this package is literally a little bag of regular expressions for these XML tokens, and yes i'm listing every single one because we do not skip items in this house:

  • BaseChar
  • Ideographic
  • Letter
  • Digit
  • Extender
  • CombiningChar
  • NameChar
  • EntityRef
  • CharRef
  • Reference
  • Name
  • NmToken
  • AttValue

the definitions of all those tokens were taken from the XML spec (Extensible Markup Language 1.0) which lives at <http://www.w3.org/TR/REC-xml> β€” iconic source material fr fr. πŸ“œβœ¨

and it also contains regular expressions for these tokens from the XML Namespaces spec over at <http://www.w3.org/TR/REC-xml-names>:

  • NCNameChar
  • NCName
  • QName
  • Prefix
  • LocalPart

so you get two specs' worth of regex energy in one package. we love a two-for-one. πŸ¦‹


πŸ‘‘ AUTHOR πŸ‘‘

the Original Author is Enno Derksen <enno@att.com> β€” respect the originator, periodt. 🫢

and please send bugs, comments and suggestions to T.J. Mather <tjmather@tjmather.com> β€” they're the main character handling all that, so be nice. πŸ’Œ


ngl this page is a whole mood: short, sweet, and full of character classes.

okay bye bestie, go validate some XML 🌈⭐

β€” cute lil sign-off: this lovely page came from the User Contributed Perl Documentation, perl v5.42.0, dated 2012-05-31. πŸ’œπŸŽ€

πŸ“¦ where this page comes from