Catman...se_text(3pm)

πŸ“¦
version 1.2025 Β· 4 versions
, in ubuntu resolute, ubuntu stonking

πŸ’– 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