Catman..._match(3pm)
π
Catman..._match(3pm) β no wait, bestie, this page is Catmandu::Fix::Condition::marc_any_match π
okay so this is a Perl manual page from the User Contributed Perl Documentation, filed under Catman..._match(3pm) (yes the name is doing its own thing, we don't question the filing system π). It's a Catmandu Fix condition, and it is so useful, like genuinely.
β¨ NAME β¨
Catmandu::Fix::Condition::marc_any_match β test if a MARC (sub)field matches a value. that's it, that's the job, and it does it flawlessly π«Ά
πΈ SYNOPSIS πΈ
the whole vibe, verbatim:
# marc_any_match(MARC_PATH,REGEX)
# Match when 245 contains the value "My funny title"
if marc_any_match('245','My funny title')
add_field('my.funny.title','true')
end
# Match when 245a contains the value "My funny title"
if marc_any_match('245a','My funny title')
add_field('my.funny.title','true')
end
# Match when at least one 650 field contains digits
if marc_any_match('650','[0-9]')
add_field('has_digits','true')
end
see how it's just if + the condition + the fixes you want + end? iconic structure, no notes π
π¦ DESCRIPTION π¦
so basically: the enclosing fixes only get evaluated if the MARC (sub)field matches a regular expression. no match, no fixes, the block just sits there respectfully π
and here's the part that matters β when the MARC field is a repeated field, then at least one of those MARC fields should match the regular expression. one little match is enough to let the whole thing through. slay β
π METHODS π
marc_any_match(MARC_PATH, REGEX)
evaluates to true when at least one MARC_PATH value matches the REGEX, and false otherwise. that's the whole personality, and honestly? it's enough π
π SEE ALSO π
Catmandu::Fix::Condition::marc_all_matchβ the sibling, the counterpart, the "all of them have to match" one. go say hi π
lowkey a tiny condition with main character energy. use it whenever you need "any of these MARC things match this pattern" and you'll never look back. periodt π
perl v5.38.2 πΈ 2024-08-03 π Catman..._match(3pm) β that's the version, the date, and the name it's filed under, and that's a wrap bestie, go write some fire fixes πβ¨π¦
π¦ where this page comes from
- debian trixie: libcatmandu-marc-perl 1.320-1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu resolute: libcatmandu-marc-perl 1.320-1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu stonking: libcatmandu-marc-perl 1.320-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