Catman..._match(3pm)
π NAME π
Catmandu::Fix::Condition::marc_all_match β okay bestie, this is the little Fix condition that checks if a MARC (sub)field matches a value. That's the whole vibe. It's a Perl thing, from the User Contributed Perl Documentation, and it is lowkey a bop. β¨
πΈ SYNOPSIS πΈ
# marc_all_match(MARC_PATH,REGEX)
# Match when 245 contains the value "My funny title"
if marc_all_match('245','My funny title')
add_field('my.funny.title','true')
end
# Match when 245a contains the value "My funny title"
if marc_all_match('245a','My funny title')
add_field('my.funny.title','true')
end
# Match when all 650 fields contain digits
if marc_all_match('650','[0-9]')
add_field('has_digits','true')
end
Look at those three little glow-ups. First one hits a whole field, second one hits a subfield, third one does the all of them thing. Slay. π
π DESCRIPTION π
So here's the tea, bestie: this condition evaluates the enclosing fixes only if the MARC (sub)field matches a regular expression. No match, no fixes. It's giving bouncer at the club. πͺβ¨
And when the MARC field is a repeated field β the source page literally spells it fiels, and honestly? we stan a typo β then all the MARC fields have to match that regular expression. Every single one. Not most of them. Not the cute ones. All of them. Periodt. π
π¦ METHODS π¦
π marc_all_match(MARC_PATH, REGEX)
Evaluates to true when all MARC_PATH values matches the REGEX, false otherwise.
That's it, that's the method. Short, sweet, does exactly what it says on the tin. π«Ά
π SEE ALSO π
Catmandu::Fix::Condition::marc_any_matchβ the chaotic sibling. If this one is "all of them or nothing", that one is "any single one and we're good." Pick your fighter. π₯
and that's the whole page, bestie!! ππ
This was perl v5.38.2, dated 2024-08-03 β shoutout to the version and the date for being here, we appreciate you. Mwah. π
π¦ 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