Catmandu::Fix::marc_replace_all3pm
Regex replace (sub)field values in a marc file
Usage
# Append to all the 650-p 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.zmarc_replace_all('100a','\bJoe\b',$.x.y.z)# Replace all the content of 100a with everything in curly bracketsmarc_replace_all('100a','^(.*)$','{$1}')
Overview
Use regex search and replace on MARC field values.
Methods
marc_replace_all(MARC_PATH , REGEX, VALUE)
For each (sub)field matching the MARC_PATH replace the pattern found by REGEX to a new VALUE. This value can be a literal or reference an existing field in the record using the dollar JSON_PATH syntax.
Inline
This Fix can be used inline in a Perl script:
use Catmandu::Fix::marc_replace_all as => 'marc_replace_all';my $data = { record => [...] };$data = marc_replace_all($data, '245a', 'test' , 'rest');
Releases
4 releases since Debian 10 (Buster); the text changed 2 times.