XML::Li...::RegExp(3)

✨ XML::LibXML::RegExp ✨

okay so bestie, welcome to XML::LibXML::RegExp πŸ’– β€” it's your lil gateway to libxml2's very own regular expression engine. No cap, this is a Perl interface to libxml2's implementation of regexes, and you'll catch it doing the most for validation of XML Schema simple types (hi, pattern facet πŸ‘‹). Periodt.


🌸 SYNOPSIS 🌸

use XML::LibXML;
my $compiled_re = XML::LibXML::RegExp->new('[0-9]{5}(-[0-9]{4})?');
if ($compiled_re->isDeterministic()) { ... }
if ($compiled_re->matches($string)) { ... }

$compiled_re = XML::LibXML::RegExp->new( $regexp_str );
$bool = $compiled_re->matches($string);
$bool = $compiled_re->isDeterministic();

πŸ¦‹ DESCRIPTION πŸ¦‹

So basically: this is a perl interface to libxml2's implementation of regular expressions. Those regexes get used, like, for validation of XML Schema simple types β€” specifically the pattern facet. It's giving ✨validator energy✨.

πŸ’œ new()

$compiled_re = XML::LibXML::RegExp->new( $regexp_str );

The constructor takes a string containing a regular expression and hands you back a compiled regexp object. Slay. You fed it a string, it feeds you a whole object. πŸ’…

πŸŽ€ matches($string)

$bool = $compiled_re->matches($string);

You give it a string value, and it returns a true value if that value is matched by the compiled regular expression. That's it, that's the whole vibe check. 🫢

🌈 isDeterministic()

$bool = $compiled_re->isDeterministic();

Returns a true value if the regular expression is deterministic; returns false otherwise. And if you're sitting there like "bestie what does deterministic even mean 😭" β€” the definition of determinism lives in the XML spec, right here: <http://www.w3.org/TR/REC-xml/#determinism> πŸ‘‘


πŸ‘‘ AUTHORS πŸ‘‘

Matt Sergeant, Christian Glahn, Petr Pajas β€” the iconique trio fr fr 🌟


⭐ VERSION ⭐

2.0213


  • 2001-2007, AxKit.com Ltd.
  • 2002-2006, Christian Glahn.
  • 2006-2009, Petr Pajas.

πŸ“ LICENSE πŸ“

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. iykyk 🌸


and that's the whole page bestie, you ate it up πŸ’… no crumbs left, literally.

perl v5.42.2 Β· 2026-05-25 β€” mwah, go forth and compile some regexes πŸ§šβœ¨πŸ’œ

πŸ“¦ where this page comes from