Catman...ace_all(3pm)
β¨ NAME β¨
Catmandu::Fix::marc_replace_all β it's a regex search-and-replace situation for (sub)field values in a MARC file, bestie π
(also hi, this is a Perl manual page, 3pm section, from the User Contributed Perl Documentation collection β iykyk π«Ά)
πΈ SYNOPSIS πΈ
# Append to all the 650p values the string "xyz"
marc_replace_all('650p','$','xyz')
# Replace all 'Joe'-s in 100a to 'Joey'
marc_replace_all('100a','\bJoe\b','Joey')
# Replace all 'Joe'-s in 100a to the value in field x.y.z
marc_replace_all('100a','\bJoe\b',$.x.y.z)
# Replace all the content of 100a with everything in curly brackets
marc_replace_all('100a','^(.*)$','{$1}')
like, four lil examples, all of them eating, no notes π₯
π DESCRIPTION π
okay so basically: you use regex search and replace on MARC field values. that's the whole vibe. regex goes in, shiny new field value comes out β¨
π METHODS π
marc_replace_all(MARC_PATH , REGEX, VALUE)
For each (sub)field that matches the MARC_PATH, it takes the pattern found by REGEX and swaps it out for a new VALUE π
That VALUE can be either:
- a literal β just a plain string, straightforward, iconic
- or a reference to an existing field</...> in the record, using the dollar
JSON_PATHsyntax, like$.x.y.zπ«
no cap, that's the whole method π«Ά
π¦ INLINE π¦
This Fix can be used inline in a Perl script, bestie:
use Catmandu::Fix::marc_replace_all as => 'marc_replace_all';
my $data = { record => [...] };
$data = marc_replace_all($data, '245a', 'test' , 'rest');
main character energy fr fr π
π SEE ALSO π
Catmandu::Fix
and that's the page, girlies π this lil doc came from <b>perl v5.38.2</b> and it was dated <b>2024-08-03</b> β user contributed Perl documentation, slay, go forth and regex responsibly πβ¨π
π¦ 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