{
    "content": [
        {
            "type": "text",
            "text": "# Data::FormValidator::Filters (perldoc)\n\n## NAME\n\nData::FormValidator::Filters - Basic set of filters available in an Data::FormValidator profile.\n\n## SYNOPSIS\n\nuse Data::FormValidator;\n%profile = (\nfilters => 'trim',\n...\n);\nmy $results = Data::FormValidator->check(  \\%data, \\%profile );\n\n## DESCRIPTION\n\nThese are the builtin filters which may be specified as a name in the *filters*,\n*fieldfilters*, and *fieldfilterregexpmap* parameters of the input profile.\n\n## Sections\n\n- **NAME**\n- **SYNOPSIS**\n- **DESCRIPTION**\n- **RECOMMENDED USE**\n- **PROCEDURAL INTERFACE**\n- **THE FILTERS**\n- **SEE ALSO**\n- **AUTHOR**\n- **COPYRIGHT**\n\nUse structuredContent.sections for detailed options, examples, and full documentation.\n"
        }
    ],
    "structuredContent": {
        "command": "Data::FormValidator::Filters",
        "section": "",
        "mode": "perldoc",
        "summary": "Data::FormValidator::Filters - Basic set of filters available in an Data::FormValidator profile.",
        "synopsis": "use Data::FormValidator;\n%profile = (\nfilters => 'trim',\n...\n);\nmy $results = Data::FormValidator->check(  \\%data, \\%profile );",
        "tldr_summary": null,
        "tldr_examples": [],
        "tldr_source": null,
        "flags": [],
        "examples": [],
        "see_also": [],
        "section_outline": [
            {
                "name": "NAME",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "SYNOPSIS",
                "lines": 9,
                "subsections": []
            },
            {
                "name": "DESCRIPTION",
                "lines": 6,
                "subsections": []
            },
            {
                "name": "RECOMMENDED USE",
                "lines": 9,
                "subsections": []
            },
            {
                "name": "PROCEDURAL INTERFACE",
                "lines": 13,
                "subsections": []
            },
            {
                "name": "THE FILTERS",
                "lines": 103,
                "subsections": []
            },
            {
                "name": "SEE ALSO",
                "lines": 9,
                "subsections": []
            },
            {
                "name": "AUTHOR",
                "lines": 3,
                "subsections": []
            },
            {
                "name": "COPYRIGHT",
                "lines": 5,
                "subsections": []
            }
        ],
        "sections": {
            "NAME": {
                "content": "Data::FormValidator::Filters - Basic set of filters available in an Data::FormValidator profile.\n",
                "subsections": []
            },
            "SYNOPSIS": {
                "content": "use Data::FormValidator;\n\n%profile = (\nfilters => 'trim',\n...\n);\n\nmy $results = Data::FormValidator->check(  \\%data, \\%profile );\n",
                "subsections": []
            },
            "DESCRIPTION": {
                "content": "These are the builtin filters which may be specified as a name in the *filters*,\n*fieldfilters*, and *fieldfilterregexpmap* parameters of the input profile.\n\nFilters are applied as the first step of validation, possibly modifying a copy of the validation\nbefore any constraints are checked.\n",
                "subsections": []
            },
            "RECOMMENDED USE": {
                "content": "As a long time maintainer and user of Data::FormValidator, I recommend that filters be used with\ncaution. They are immediately modifying the input provided, so the original data is lost. The\nfew I recommend include \"trim\", which removes leading and trailing whitespace. I have this\nturned on by default by using CGI::Application::Plugin::ValidateRM. It's also generally safe to\nuse the \"lc\" and \"uc\" filters if you need that kind of data transformation.\n\nBeyond simple filters, I recommend transforming the \"valid\" hash returned from validation if\nfurther changes are needed.\n",
                "subsections": []
            },
            "PROCEDURAL INTERFACE": {
                "content": "You may also call these functions directly through the procedural interface by either importing\nthem directly or importing the whole *:filters* group. For example, if you want to access the\n*trim* function directly, you could either do:\n\nuse Data::FormValidator::Filters (qw/filtertrim/);\n# or\nuse Data::FormValidator::Filters (qw/:filters/);\n\n$string = filtertrim($string);\n\nNotice that when you call filters directly, you'll need to prefix the filter name with\n\"filter\".\n",
                "subsections": []
            },
            "THE FILTERS": {
                "content": "FVsplit\nuse Data::FormValidator::Filters qw(FVsplit);\n\n# Validate every e-mail in a comma separated list\n\nfieldfilters => {\nseveralemails  => FVsplit(qr/\\s*,\\s*/),\n\n# Any pattern that can be used by the 'split' builtin works.\ntabsepfield   => FVsplit('\\t'),\n},\nconstraintmethods => {\nseveralemails => email(),\n},\n\nWith this filter, you can split a field into multiple values. The constraint for the field will\nthen be applied to every value.\n\nThis filter has a different naming convention because it is a higher-order function. Rather than\nreturning a value directly, it returns a code reference to a standard Data::FormValidator\nfilter.\n\nAfter successfully being validated the values will appear as an arrayref.\n\nFVreplace\nuse Data::FormValidator::Filters qw(FVreplace);\n\nfieldfilters => {\nfirstname   => FVreplace(qr/Mark/,'Don'),\n},\n\nFVreplace is a shorthand for writing simple find-and-replace filters. The above filter would be\ntranslated to this:\n\nsub { my $v = shift; $v =~ s/Mark/Don/; $v }\n\nFor more complex filters, just write your own.\n\ntrim\nRemove white space at the front and end of the fields.\n\nstrip\nRuns of white space are replaced by a single space.\n\ndigit\nRemove non digits characters from the input.\n\nalphanum\nRemove non alphanumeric characters from the input.\n\ninteger\nExtract from its input a valid integer number.\n\nposinteger\nExtract from its input a valid positive integer number.\n\nBugs: This filter won't extract \"9\" from \"a9+\", it will instead extract \"9+\"\n\nneginteger\nExtract from its input a valid negative integer number.\n\nBugs: This filter will currently filter the case of \"a9-\" to become \"9-\", which it should leave\nit alone.\n\ndecimal\nExtract from its input a valid decimal number.\n\nBugs: Given \"1,000.23\", it will currently return \"1.000.23\"\n\nposdecimal\nExtract from its input a valid positive decimal number.\n\nBugs: Given \"1,000.23\", it will currently return \"1.000.23\"\n\nnegdecimal\nExtract from its input a valid negative decimal number.\n\nBugs: Given \"1,000.23\", it will currently return \"1.000.23\"\n\ndollars\nExtract from its input a valid number to express dollars like currency.\n\nBugs: This filter won't currently remove trailing numbers like \"1.234\".\n\nphone\nFilters out characters which aren't valid for an phone number. (Only accept digits [0-9], space,\ncomma, minus, parenthesis, period and pound [#].)\n\nsqlwildcard\nTransforms shell glob wildcard (*) to the SQL like wildcard (%).\n\nquotemeta\nCalls the quotemeta (quote non alphanumeric character) builtin on its input.\n\nlc\nCalls the lc (convert to lowercase) builtin on its input.\n\nuc\nCalls the uc (convert to uppercase) builtin on its input.\n\nucfirst\nCalls the ucfirst (Uppercase first letter) builtin on its input.\n",
                "subsections": []
            },
            "SEE ALSO": {
                "content": "o\nL<Data::FormValidator>\n\no\nL<Data::FormValidator::Constraints>\n\no\nL<Data::FormValidator::Filters::Image> - shrink incoming image uploads\n",
                "subsections": []
            },
            "AUTHOR": {
                "content": "Author:  Francis J. Lacoste <francis.lacoste@iNsu.COM>\nMaintainer: Mark Stosberg <mark@summersault.com>\n",
                "subsections": []
            },
            "COPYRIGHT": {
                "content": "Copyright (c) 1999,2000 iNsu Innovations Inc. All rights reserved.\n\nThis program is free software; you can redistribute it and/or modify it under the terms as perl\nitself.\n",
                "subsections": []
            }
        }
    }
}