NAME

SVG::Rasterize::Regexes - Commonly used regular expressions

VERSION

Version 0.001002

DESCRIPTION

The following regular expressions are used at different locations of the code to validate or extract user input. It is not part of the interface where exactly they are used. They are documented for inspection only. They are compiled into other expressions so changing them will probably not achieve what you might expect. The exception to this rule is the PACKAGE_NAME variable. The other items are more or less a direct translation of parts of the Backus Naur form given by the SVG specification for the transform attribute (http://www.w3.org/TR/SVG11/coords.html#TransformAttribute).

  • PACKAGE_PART

    qr/[a-zA-Z][a-zA-Z0-9\_]*/
  • PACKAGE_NAME

    qr/^$PACKAGE_PART(?:\:\:PACKAGE_PART)*$/

    Package names given to methods in this distribution, namely the engine_class parameters have to match this regular expression. I am not sure which package names exactly are allowed. If you know where in the Perl manpages or the Camel book this is described, please point me to it. If this pattern is too strict for your favourite package name, you can change this variable.

  • INTEGER

    qr/[\+\-]?\d+/;

    Note that this allows leading zeroes like '00030'. This is for compliance with the SVG specification.

  • FRACTION

    qr/[\+\-]?(?:\d*\.\d+|\d+\.)/;

    Floating point number in non-scientific notation. Note that this allows leading zeroes like '000.123'. This is for compliance with the SVG specification.

  • EXPONENT

    qr/[eE][\+\-]?\d+/;
  • FLOAT

    qr/$FRACTION$EXPONENT?|$INTEGER$EXPONENT/;

    Floating point number in decimal or scientific notation.

  • P_NUMBER

    qr/$INTEGER|$FRACTION/;

    Number allowed in CSS compliant style properties: integer or float in decimal notation.

  • A_NUMBER

    qr/$INTEGER|$FLOAT/;

    Number allowed in XML attributes. Integer or float in either decimal or scientific notation.

  • UNIT

    qr/em|ex|px|pt|pc|cm|mm|in|\%/;
  • P_LENGTH

    qr/$P_NUMBER$UNIT?/;
  • A_LENGTH

    qr/$A_NUMBER$UNIT?/;

SEE ALSO

AUTHOR

Lutz Gehlen, <perl at lutzgehlen.de>

LICENSE AND COPYRIGHT

Copyright 2010 Lutz Gehlen.

This program is free software; you can redistribute it and/or modify it under the terms of either: the GNU General Public License as published by the Free Software Foundation; or the Artistic License.

See http://dev.perl.org/licenses/ for more information.