Catman...se_text(3pm)
π Catmandu::Fix::parse_text π
okay bestie, so this is Catmandu::Fix::parse_text, and it lives in the User Contributed Perl Documentation section of the manual β it's a Perl thing, 3pm, you know the vibe. π¦
β¨ NAME β¨
Catmandu::Fix::parse_text β it parses a text into an array or hash of values β¨ literally that's the whole job and it ate π
πΈ SYNOPSIS πΈ
okay so picture this: you've got a string and you want it un-strung into lil pieces. that's the whole thing. watch π
# date: "2015-03-07"
parse_text(date, '(\d\d\d\d)-(\d\d)-(\d\d)')
# date:
# - 2015
# - 03
# - 07
see how it gave you an array?? one capture group per slot, in order, no notes. π
and now the named version, because we love a girl who labels her things:
# date: "2015-03-07"
parse_text(date, '(?<year>\d\d\d\d)-(?<month>\d\d)-(?<day>\d\d)')
# date:
# year: "2015"
# month: "03"
# day: "07"
boom. hash. the names you gave in the pattern are the keys, the matched bits are the values. iconic behaviour fr fr π
and now the part where nothing matches, and honestly? it just does not care:
# date: "abcd"
parse_text(date, '(\d\d\d\d)-(\d\d)-(\d\d)')
# date: "abcd"
vibe check failed β the value just stays exactly as it was. no array, no hash, no drama, no cap. π it's giving "we move on" π§
π SEE ALSO π
- Catmandu::Fix β the mothership, go say hi π
- Catmandu::Importer::Text β the other text-y bestie, iykyk π
mwah π that's the whole page. this was served up by perl v5.40.1, dated 2026-01-24, brought to you by the User Contributed Perl Documentation crew. stay parsing, bestie π«Άβ¨
π¦ where this page comes from
- ubuntu resolute: libcatmandu-perl 1.2025-1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu stonking: libcatmandu-perl 1.2025-1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms