Many thanks to everyone who responded to my question! I'll give these
suggestions a try during our next vendor load.
All the best,
Miriam C. Nauenburg
Serials and Electronic Resources Cataloger
Ingram Library
University of West Georgia
Carrollton, GA 30118
Phone: (678) 839-5327
FAX: (678) 839-6511
On 6/1/2016 10:09 AM, Nickeson, Walter wrote:
> Building on Tom's ingenious suggestion, I came up with a slightly different approach. It also uses the "zero-width negative lookahead assertion" (<https://msdn.microsoft.com/en-us/library/az24scfc#grouping_constructs>) to match only when something's not found:
>
> Find: (=300.+\$a)(?!1 online resource \()(.+?)(\$.*|$)
> Replace: ${1}1 online resource ($2)$3
>
> How this differs from Tom's solution: If a 300 field does NOT contain the string "1 online resource (" immediately following "$a", the regex takes the contents of subfield $a--everything up to either the next delimiter or the end of the field (in case some fields consist only an extent statement in subfield $a)--and puts them within parentheses. In this example:
>
> =300 \\$axvi, 244 p., [12] p. of plates$bill.$c23 cm.
>
> Matching group $2 is not the second group in the "Find" expression, which is "(?!1 online resource \()", but rather the second group actually found--"xvi, 244 p., [12] p. of plates", or everything between "$a" and the first following delimiter. That string is wrapped in parentheses and placed after the "1 online resource" string. The replacement string continues with everything else found in the field.
>
> This example has a repeated "p." which I think trips up Tom's regex.
>
> If all (or worse, some) of the records contain ISBD punctuation, the situation gets more complicated.
>
> *****************************************
> Walter F. Nickeson, Catalog &
> Metadata Management Librarian
> Rush Rhees Library
> University of Rochester
> Rochester, NY 14627-0055
> [log in to unmask]
> (585) 273-2326 fax: (585) 273-1032
> *****************************************
>
> -----Original Message-----
> From: MarcEdit support in technical and instructional matters [mailto:[log in to unmask]] On Behalf Of Meehan, Thomas
> Sent: Wednesday, June 01, 2016 6:07 AM
> To: [log in to unmask]
> Subject: Re: [MARCEDIT-L] Add "1 online resource" to 300$a, but not if the phrase is already present
>
> I think this is possible using a negative lookahead (looks ahead for a string and doesn't match if it's there). I think the following should work, assuming that all your 300s have either "p." or "v." in the $a:
>
> Find:
> =300....\$a(?!1 online)(.*)(p|v)(\.?)(.*)
> Replace:
> 300 \\$a1 online resource ($1$2$3)$4
>
> The (?!whatever) is the lookahead part.
>
> Cheers,
>
> Tom
>
> ---
>
> Thomas Meehan
> Head of Cataloguing and Metadata
> University College London
>
>
> -----Original Message-----
> From: MarcEdit support in technical and instructional matters [mailto:[log in to unmask]] On Behalf Of Miriam Nauenburg
> Sent: 31 May 2016 17:08
> To: [log in to unmask]
> Subject: [MARCEDIT-L] Add "1 online resource" to 300$a, but not if the phrase is already present
>
> I am trying to add "1 online resource" to the 300 $a of the records in an ebook marc file. The problem is that some records in the file already have "1 online resource" in the 300$a, so the regex I've been using adds the phrase again. For example:
>
> 300 $a 1 online resource (34 p.) $b ill.
> 300 $a 1 online resource (1 online resource (74 p.)) $b ill.
>
> Is there a way to use the "Perform find/replace if..." function to exclude the records that already have "1 online resource" in the 300$a?
>
> Thanks for any help with this,
>
>
> Miriam C. Nauenburg
> Serials and Electronic Resources Cataloger Ingram Library University of West Georgia Carrollton, GA 30118
> Phone: (678) 839-5327
> FAX: (678) 839-6511
>
> ________________________________________________________________________
>
> This message comes to you via MARCEDIT-L, a Listserv(R) list for technical and instructional support in MarcEdit. If you wish to communicate directly with the list owners, write to [log in to unmask] To unsubscribe, send a message "SIGNOFF MARCEDIT-L" to [log in to unmask]
________________________________________________________________________
This message comes to you via MARCEDIT-L, a Listserv(R) list for technical and instructional support in MarcEdit. If you wish to communicate directly with the list owners, write to [log in to unmask] To unsubscribe, send a message "SIGNOFF MARCEDIT-L" to [log in to unmask]
|