Geoffrey:
I don't use NoteTab, but this will work in MarcEdit:
Try naming the string you are going to reuse, instead of referring to it by its default string number. The name can be anything you want to use -- "block" "marcTag" "frontend" "incipit" ... enclosed in <angle brackets>, preceded by a question mark.
When it's time to reuse it in the replace statement, enclose the name in {curly brackets}, preceded by the dollar sign.
You don't want to escape the equal sign in MarcEdit, but you will need to escape the back-slash. The equal sign has a "special function" in MarcEdit at the beginning of a line, but it is not one of the regex "special characters" which are: . $ ^ { [ ( | ) * + ? \
Find: (?<block>^=246 .)\\
Replace ${block}3
[x] Use regular expressions
Translation:
start at the beginning of the line
find the MARC 246 tag
followed by two blank spaces
followed by any character as the first indicator
followed by a literal back-slash
group everything before the back-slash as a string named "block"
re-write the string called "block"
followed by the digit "3"
Documentation:
Ben Abrahamse has some nice regex slides up; check p. 25-27 here:
http://www.masslib.org/Resources/Documents/Abrahamse%20MARCEdit%202012.pdf
There are several discussions of this named groups tactic in the MARCEDIT-L archive.
See also
https://msdn.microsoft.com/en-us/library/bs2twtah.aspx#Anchor_1
https://msdn.microsoft.com/en-us/library/az24scfc.aspx#Anchor_3
http://www.regexr.com/
Doug Rippey
Metadata Technician
University Libraries
Archives Processing and
Digital Content Metadata
303-871-4951
[log in to unmask]
http://library.du.edu
-----Original Message-----
From: MarcEdit support in technical and instructional matters [mailto:[log in to unmask]] On Behalf Of Geoffrey Skinner
Sent: Friday, June 17, 2016 5:00 PM
To: [log in to unmask]
Subject: [MARCEDIT-L] RegEx replacement of a pattern followed by a digit
There may already be a discussion of this that I've overlooked, but if not:
I have been using RegEx in various contexts for many years, but am stumped by trying to replace a pattern followed by a digit in MarcEdit. For example (a made up one), say I want to find all the instances of 246 tags with a second indicator of [blank] and change the second indicator to 3, so I could look for (\=246 .)\ and in NoteTab, my replace with statement would be $1\3. The result would be =246 13 or =246 33, but in MarcEdit, I would get =246 1\3 or =246 3\3; not escaping the 3 gives me a literal: $13. I don't see a solution in the MarcEdit help, but perhaps someone here could share it. Thanks!
Geoffrey
--------------------------------------------------------------------------
Geoffrey Skinner, Cataloging and Metadata Librarian Sonoma County Library
211 E Street, Santa Rosa, CA
[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]
________________________________________________________________________
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]
|