Catman..._match(3pm)

πŸ“¦
version 1.320 Β· 4 versions
, in debian trixie, ubuntu resolute, ubuntu stonking

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