SlideShare a Scribd company logo
1 of 26
Getting Started with
Regular Expressions
in MarcEdit
TERRY REESE
HEAD OF DIGITAL INITIATIVES, THE OHIO STATE
UNIVERSITY
Topics
MarcEdit Regular Expression Support Information
Understanding .NET Regular Expressions
◦ Major components of the language
◦ Understanding grouping mechanisms and references
How Does MarcEdit implement expressions
Getting Regular Expression Help
MarcEdit Regular Expression
Support
Functions that presently support regular expressions
◦ Delete Field
◦ Edit Field
◦ Copy Field
◦ Swap Field
◦ Build New Field
◦ Extract/Delete Records
◦ Validation Processing
◦ Linked Data tooling
◦ More…
MarcEdit Regular Expression
Support
When processing regular expressions with MarcEdit, MarcEdit makes
entire fields or subfields available for processing
◦ i.e., when processing a delete field function – all data from =[field number]
are part of the field that can be queried.
MarcEdit’s regular expression by default deals with one field at a time
(i.e., regular expressions do not allow you to find data across fields by
default)
MarcEdit’s Regular Expression Support is defined by Microsoft .NET’s
Regular Expression object
◦ This object uses a syntax that looks Perl-like, but has some differences.
Microsoft’s Regular Expression
language
Concepts:
◦ Character escapes
◦ Anchors
◦ Character classes
◦ Grouping
◦ Qualifiers
◦ Substitutions
MSDN Documentation: https://msdn.microsoft.com/en-
us/library/az24scfc(v=vs.110).aspx
PDF Quick Reference:
http://download.microsoft.com/download/D/2/4/D240EBF6-A9BA-4E4F-
A63F-AEB6DA0B921C/Regular%20expressions%20quick%20reference.pdf
How we use Regular
Expressions in MarcEdit
Your most important parts of the regular expression language are:
1. Character escapes: drn$x##
2. Character Classes [] & [^]
3. Grouping Elements ()
4. Anchors: ^$
5. Quantifiers: *?+{#}
6. Substitutions: $#
How Expressions Manifest in
MarcEdit
Part of understanding regular expressions in
MarcEdit, is understanding what data is exposed to
the Regular expression engine.
Each of MarcEdit’s global edit functions see different
levels of data
This is important to understand when:
 Creating processing strategies
 Knowing which global editing function to choose
Replace Function
Replace Function
Provides:
 Access to all field data
 Can be processed across fields
(lines)
 Can do preconditional
sorting/evaluation before
evaluating for replacement (can
search for data in one field, and
then perform and action on
another if true)
 Provides most access to record
data for evaluation
Add/Delete Function
Add/Delete Function
Provides:
 Access to all field data from the
equal sign to end of line
 No option to evaluate across fields
 Only available when deleting data
Edit Field Data
Edit Field Data Function
Provides:
 Access all data after the indicators
(no indicator or field data access)
 Can be used to break up fields into
new fields and do recursive
searching
Edit Subfield Data
Edit Subfield Data
Provides:
 Only provides access to the defined
subfield or control data positions
Regular Expression Basics
I like to think of regular expressions the same way as I think of
diagraming a sentence.
http://www.english-grammar-
revolution.com/images/puzzler_words_october_2012.jpg
Regular Expression Basics
I am trying to look at the data I want to replace and break it into its
component parts. For example if I wanted to add a period to the 500 if
it is missing
Source Fields:
=500 $aPrime meridians: Greenwich and Washington
=500 $aPrime meridians: Greenwich and Washington?
Structure:
Expression: (=500.*[^W])$
Examples
Looking at example.txt using the replace function:
◦ Add a period to the 500 if it is missing
◦ Add a $h of cartographic resources between the $a and $c .
◦ Split the 856 into two fields, breaking on the $u.
Examples 1
◦ Add a period to the 500 if it is missing
◦ Find What: (=500.*[^W])$
◦ Replace With: $1.
Explanation:
◦ (=500.*[^W])$
◦ Searches for the 500, then matches all data in the line, until you get to the final character. It
then evaluates the final character to see if it’s a not a word character
Example 2
◦ Add a $h of cartographic resources between the $a and $c .
Find What: (=245.{4})($a.*)(/.*)
◦ (=245.{4})
◦ Match the 245 field with any value in the next 4 characters being valid.
◦ ($a.*)
◦ Select everything within the subfield a
◦ (/$c.*)
◦ Select the / value and the subfield c (and other data)
Replace With: $1$2$$h[cartographic resource] $3
Example 3
Split the 856 into two fields, breaking on the $u.
◦ Find What: (=856.{4})($u.*[^$])($u.*)
◦ (=856.{4})
◦ Matches the 856 field
◦ ($u.*[^$])
◦ Match $u, but stop at the end of the subfield
◦ ($u.*)
◦ Match reminder of field
◦ Replace With: $1$2n=856 41$3
Lcase/ucase
MarcEdit’s regular expression engine includes to extension functions for
dealing with case switching of characters.
◦ lcase & ucase
◦ Usage: (=450.{4})($a.)(.*)
◦ $1$2lcase($3)
◦ Example: Find the 500 with all upper case characters and convert the case of
all values but the first letter in the sentence to lower case.
Multi-Field Replacements
By default, MarcEdit handles one field at a time when doing regular
expressions.
◦ However, when you need to do evaluations against multiple fields, you can
by adding /m to the end of your replacement in the Replace Function in the
MarcEditor
◦ This is a special function added to the MarcEdit regular expression engine
Delete Field Function
The delete field function exposes all the data in the field to be acted
upon as a regular expression.
◦ i.e. =856 .*
◦ So the first value in the Delete Field evaluation is an =, not the subfield data
◦ The reason to do this is to allow for explicit evaluations of indicators.
Getting Regular Expression
Help
The MarcEdit Listserv has a number of regular expression experts that
provide a lot of help to users looking for it
http://metis3.gmu.edu/cgi-bin/wa?A0=MARCEDIT-L
Questions

More Related Content

Similar to Getting Started with Regular Expressions in MarcEdit

MarcEdit Shelter-In-Place Webinar 7: Making Regular Expressions work for you ...
MarcEdit Shelter-In-Place Webinar 7: Making Regular Expressions work for you ...MarcEdit Shelter-In-Place Webinar 7: Making Regular Expressions work for you ...
MarcEdit Shelter-In-Place Webinar 7: Making Regular Expressions work for you ...Terry Reese
 
Mysqlppt
MysqlpptMysqlppt
MysqlpptReka
 
SQL Server 2008 Performance Enhancements
SQL Server 2008 Performance EnhancementsSQL Server 2008 Performance Enhancements
SQL Server 2008 Performance Enhancementsinfusiondev
 
Spark SQL Deep Dive @ Melbourne Spark Meetup
Spark SQL Deep Dive @ Melbourne Spark MeetupSpark SQL Deep Dive @ Melbourne Spark Meetup
Spark SQL Deep Dive @ Melbourne Spark MeetupDatabricks
 
Refactoring to Java 8 (Devoxx BE)
Refactoring to Java 8 (Devoxx BE)Refactoring to Java 8 (Devoxx BE)
Refactoring to Java 8 (Devoxx BE)Trisha Gee
 
BP208 Fabulous Feats with @Formula
BP208 Fabulous Feats with @FormulaBP208 Fabulous Feats with @Formula
BP208 Fabulous Feats with @FormulaKathy Brown
 
Database Management Lab -SQL Queries
Database Management Lab -SQL Queries Database Management Lab -SQL Queries
Database Management Lab -SQL Queries shamim hossain
 
Analysing Performance of Algorithmic SQL and PLSQL.pptx
Analysing Performance of Algorithmic SQL and PLSQL.pptxAnalysing Performance of Algorithmic SQL and PLSQL.pptx
Analysing Performance of Algorithmic SQL and PLSQL.pptxBrendan Furey
 

Similar to Getting Started with Regular Expressions in MarcEdit (20)

MarcEdit Shelter-In-Place Webinar 7: Making Regular Expressions work for you ...
MarcEdit Shelter-In-Place Webinar 7: Making Regular Expressions work for you ...MarcEdit Shelter-In-Place Webinar 7: Making Regular Expressions work for you ...
MarcEdit Shelter-In-Place Webinar 7: Making Regular Expressions work for you ...
 
Mysqlppt
MysqlpptMysqlppt
Mysqlppt
 
SQL Server 2008 Performance Enhancements
SQL Server 2008 Performance EnhancementsSQL Server 2008 Performance Enhancements
SQL Server 2008 Performance Enhancements
 
Spark SQL Deep Dive @ Melbourne Spark Meetup
Spark SQL Deep Dive @ Melbourne Spark MeetupSpark SQL Deep Dive @ Melbourne Spark Meetup
Spark SQL Deep Dive @ Melbourne Spark Meetup
 
Mysqlppt
MysqlpptMysqlppt
Mysqlppt
 
Mysqlppt
MysqlpptMysqlppt
Mysqlppt
 
Module02
Module02Module02
Module02
 
ADVANCE ITT BY PRASAD
ADVANCE ITT BY PRASADADVANCE ITT BY PRASAD
ADVANCE ITT BY PRASAD
 
Refactoring to Java 8 (Devoxx BE)
Refactoring to Java 8 (Devoxx BE)Refactoring to Java 8 (Devoxx BE)
Refactoring to Java 8 (Devoxx BE)
 
Introduction to DAX Language
Introduction to DAX LanguageIntroduction to DAX Language
Introduction to DAX Language
 
Data structures using c
Data structures using cData structures using c
Data structures using c
 
Data structures using C
Data structures using CData structures using C
Data structures using C
 
PT- Oracle session01
PT- Oracle session01 PT- Oracle session01
PT- Oracle session01
 
Lect11
Lect11Lect11
Lect11
 
BP208 Fabulous Feats with @Formula
BP208 Fabulous Feats with @FormulaBP208 Fabulous Feats with @Formula
BP208 Fabulous Feats with @Formula
 
Database Management Lab -SQL Queries
Database Management Lab -SQL Queries Database Management Lab -SQL Queries
Database Management Lab -SQL Queries
 
NOTES ON "FOXPRO"
NOTES ON "FOXPRO" NOTES ON "FOXPRO"
NOTES ON "FOXPRO"
 
Analysing Performance of Algorithmic SQL and PLSQL.pptx
Analysing Performance of Algorithmic SQL and PLSQL.pptxAnalysing Performance of Algorithmic SQL and PLSQL.pptx
Analysing Performance of Algorithmic SQL and PLSQL.pptx
 
Dbms
DbmsDbms
Dbms
 
Etl2
Etl2Etl2
Etl2
 

More from Terry Reese

MarcEdit Shelter-In-Place Webinar 6: Regular Expressions and .NET, A Primer
MarcEdit Shelter-In-Place Webinar 6: Regular Expressions and .NET, A PrimerMarcEdit Shelter-In-Place Webinar 6: Regular Expressions and .NET, A Primer
MarcEdit Shelter-In-Place Webinar 6: Regular Expressions and .NET, A PrimerTerry Reese
 
MarcEdit Shelter-In-Place Webinar 5.5: Transliterations in MarcEdit
MarcEdit Shelter-In-Place Webinar 5.5: Transliterations in MarcEditMarcEdit Shelter-In-Place Webinar 5.5: Transliterations in MarcEdit
MarcEdit Shelter-In-Place Webinar 5.5: Transliterations in MarcEditTerry Reese
 
MarcEdit Shelter-In-Place Webinar 5: Working with MarcEdit's Linked Data Fram...
MarcEdit Shelter-In-Place Webinar 5: Working with MarcEdit's Linked Data Fram...MarcEdit Shelter-In-Place Webinar 5: Working with MarcEdit's Linked Data Fram...
MarcEdit Shelter-In-Place Webinar 5: Working with MarcEdit's Linked Data Fram...Terry Reese
 
MarcEdit Shelter-In-Place Webinar 4: Merging, Clustering, and Integrations…oh...
MarcEdit Shelter-In-Place Webinar 4: Merging, Clustering, and Integrations…oh...MarcEdit Shelter-In-Place Webinar 4: Merging, Clustering, and Integrations…oh...
MarcEdit Shelter-In-Place Webinar 4: Merging, Clustering, and Integrations…oh...Terry Reese
 
MarcEdit Shelter-in-place Webinar 2.5: Getting Started with MarcEdit Mac
MarcEdit Shelter-in-place Webinar 2.5: Getting Started with MarcEdit MacMarcEdit Shelter-in-place Webinar 2.5: Getting Started with MarcEdit Mac
MarcEdit Shelter-in-place Webinar 2.5: Getting Started with MarcEdit MacTerry Reese
 
Working with the MarcEditor
Working with the MarcEditorWorking with the MarcEditor
Working with the MarcEditorTerry Reese
 
Slides from the NASIG 2018 Preconference
Slides from the NASIG 2018 PreconferenceSlides from the NASIG 2018 Preconference
Slides from the NASIG 2018 PreconferenceTerry Reese
 
Making complicated processes simple: a look at how MarcEdit 7 is expanding th...
Making complicated processes simple: a look at how MarcEdit 7 is expanding th...Making complicated processes simple: a look at how MarcEdit 7 is expanding th...
Making complicated processes simple: a look at how MarcEdit 7 is expanding th...Terry Reese
 
Rejoining the Information access landscape
Rejoining the Information access landscapeRejoining the Information access landscape
Rejoining the Information access landscapeTerry Reese
 
Open metadata, open systems…redrawing the library metadata landscape
Open metadata, open systems…redrawing the library metadata landscapeOpen metadata, open systems…redrawing the library metadata landscape
Open metadata, open systems…redrawing the library metadata landscapeTerry Reese
 
Thinking about Preservation: OSUL Content Manage Workflow
Thinking about Preservation: OSUL Content Manage WorkflowThinking about Preservation: OSUL Content Manage Workflow
Thinking about Preservation: OSUL Content Manage WorkflowTerry Reese
 
The world beyond MARC: let’s focus on asking the right questions
The world beyond MARC: let’s focus on asking the right questionsThe world beyond MARC: let’s focus on asking the right questions
The world beyond MARC: let’s focus on asking the right questionsTerry Reese
 
Reframing Public Housing: Visualization and Data Analytics in History
Reframing Public Housing: Visualization and Data Analytics in History Reframing Public Housing: Visualization and Data Analytics in History
Reframing Public Housing: Visualization and Data Analytics in History Terry Reese
 
#mashcat: Evolving MarcEdit: Leveraging Semantic Data in MarcEdit
#mashcat: Evolving MarcEdit: Leveraging Semantic Data in MarcEdit#mashcat: Evolving MarcEdit: Leveraging Semantic Data in MarcEdit
#mashcat: Evolving MarcEdit: Leveraging Semantic Data in MarcEditTerry Reese
 
Preparing Catalogers for Linked data
Preparing Catalogers for Linked dataPreparing Catalogers for Linked data
Preparing Catalogers for Linked dataTerry Reese
 
Harnessing the Lifecycle: Planning and Implementing a Strategic Digital Coll...
Harnessing the Lifecycle: Planning and Implementing a Strategic Digital Coll...Harnessing the Lifecycle: Planning and Implementing a Strategic Digital Coll...
Harnessing the Lifecycle: Planning and Implementing a Strategic Digital Coll...Terry Reese
 
Making RDA Easy(er) with MarcEdit
Making RDA Easy(er) with MarcEditMaking RDA Easy(er) with MarcEdit
Making RDA Easy(er) with MarcEditTerry Reese
 
Open Repositories 2014 Poster -- Managing Change: An Organizational Outline f...
Open Repositories 2014 Poster -- Managing Change: An Organizational Outline f...Open Repositories 2014 Poster -- Managing Change: An Organizational Outline f...
Open Repositories 2014 Poster -- Managing Change: An Organizational Outline f...Terry Reese
 
MarcEdit and OCLC Integration -- Summer ALA 2014
MarcEdit and OCLC Integration -- Summer ALA 2014MarcEdit and OCLC Integration -- Summer ALA 2014
MarcEdit and OCLC Integration -- Summer ALA 2014Terry Reese
 
Make MarcEdit Work For You: OLC Technical Services Retreat
Make MarcEdit Work For You: OLC Technical Services RetreatMake MarcEdit Work For You: OLC Technical Services Retreat
Make MarcEdit Work For You: OLC Technical Services RetreatTerry Reese
 

More from Terry Reese (20)

MarcEdit Shelter-In-Place Webinar 6: Regular Expressions and .NET, A Primer
MarcEdit Shelter-In-Place Webinar 6: Regular Expressions and .NET, A PrimerMarcEdit Shelter-In-Place Webinar 6: Regular Expressions and .NET, A Primer
MarcEdit Shelter-In-Place Webinar 6: Regular Expressions and .NET, A Primer
 
MarcEdit Shelter-In-Place Webinar 5.5: Transliterations in MarcEdit
MarcEdit Shelter-In-Place Webinar 5.5: Transliterations in MarcEditMarcEdit Shelter-In-Place Webinar 5.5: Transliterations in MarcEdit
MarcEdit Shelter-In-Place Webinar 5.5: Transliterations in MarcEdit
 
MarcEdit Shelter-In-Place Webinar 5: Working with MarcEdit's Linked Data Fram...
MarcEdit Shelter-In-Place Webinar 5: Working with MarcEdit's Linked Data Fram...MarcEdit Shelter-In-Place Webinar 5: Working with MarcEdit's Linked Data Fram...
MarcEdit Shelter-In-Place Webinar 5: Working with MarcEdit's Linked Data Fram...
 
MarcEdit Shelter-In-Place Webinar 4: Merging, Clustering, and Integrations…oh...
MarcEdit Shelter-In-Place Webinar 4: Merging, Clustering, and Integrations…oh...MarcEdit Shelter-In-Place Webinar 4: Merging, Clustering, and Integrations…oh...
MarcEdit Shelter-In-Place Webinar 4: Merging, Clustering, and Integrations…oh...
 
MarcEdit Shelter-in-place Webinar 2.5: Getting Started with MarcEdit Mac
MarcEdit Shelter-in-place Webinar 2.5: Getting Started with MarcEdit MacMarcEdit Shelter-in-place Webinar 2.5: Getting Started with MarcEdit Mac
MarcEdit Shelter-in-place Webinar 2.5: Getting Started with MarcEdit Mac
 
Working with the MarcEditor
Working with the MarcEditorWorking with the MarcEditor
Working with the MarcEditor
 
Slides from the NASIG 2018 Preconference
Slides from the NASIG 2018 PreconferenceSlides from the NASIG 2018 Preconference
Slides from the NASIG 2018 Preconference
 
Making complicated processes simple: a look at how MarcEdit 7 is expanding th...
Making complicated processes simple: a look at how MarcEdit 7 is expanding th...Making complicated processes simple: a look at how MarcEdit 7 is expanding th...
Making complicated processes simple: a look at how MarcEdit 7 is expanding th...
 
Rejoining the Information access landscape
Rejoining the Information access landscapeRejoining the Information access landscape
Rejoining the Information access landscape
 
Open metadata, open systems…redrawing the library metadata landscape
Open metadata, open systems…redrawing the library metadata landscapeOpen metadata, open systems…redrawing the library metadata landscape
Open metadata, open systems…redrawing the library metadata landscape
 
Thinking about Preservation: OSUL Content Manage Workflow
Thinking about Preservation: OSUL Content Manage WorkflowThinking about Preservation: OSUL Content Manage Workflow
Thinking about Preservation: OSUL Content Manage Workflow
 
The world beyond MARC: let’s focus on asking the right questions
The world beyond MARC: let’s focus on asking the right questionsThe world beyond MARC: let’s focus on asking the right questions
The world beyond MARC: let’s focus on asking the right questions
 
Reframing Public Housing: Visualization and Data Analytics in History
Reframing Public Housing: Visualization and Data Analytics in History Reframing Public Housing: Visualization and Data Analytics in History
Reframing Public Housing: Visualization and Data Analytics in History
 
#mashcat: Evolving MarcEdit: Leveraging Semantic Data in MarcEdit
#mashcat: Evolving MarcEdit: Leveraging Semantic Data in MarcEdit#mashcat: Evolving MarcEdit: Leveraging Semantic Data in MarcEdit
#mashcat: Evolving MarcEdit: Leveraging Semantic Data in MarcEdit
 
Preparing Catalogers for Linked data
Preparing Catalogers for Linked dataPreparing Catalogers for Linked data
Preparing Catalogers for Linked data
 
Harnessing the Lifecycle: Planning and Implementing a Strategic Digital Coll...
Harnessing the Lifecycle: Planning and Implementing a Strategic Digital Coll...Harnessing the Lifecycle: Planning and Implementing a Strategic Digital Coll...
Harnessing the Lifecycle: Planning and Implementing a Strategic Digital Coll...
 
Making RDA Easy(er) with MarcEdit
Making RDA Easy(er) with MarcEditMaking RDA Easy(er) with MarcEdit
Making RDA Easy(er) with MarcEdit
 
Open Repositories 2014 Poster -- Managing Change: An Organizational Outline f...
Open Repositories 2014 Poster -- Managing Change: An Organizational Outline f...Open Repositories 2014 Poster -- Managing Change: An Organizational Outline f...
Open Repositories 2014 Poster -- Managing Change: An Organizational Outline f...
 
MarcEdit and OCLC Integration -- Summer ALA 2014
MarcEdit and OCLC Integration -- Summer ALA 2014MarcEdit and OCLC Integration -- Summer ALA 2014
MarcEdit and OCLC Integration -- Summer ALA 2014
 
Make MarcEdit Work For You: OLC Technical Services Retreat
Make MarcEdit Work For You: OLC Technical Services RetreatMake MarcEdit Work For You: OLC Technical Services Retreat
Make MarcEdit Work For You: OLC Technical Services Retreat
 

Recently uploaded

_Math 4-Q4 Week 5.pptx Steps in Collecting Data
_Math 4-Q4 Week 5.pptx Steps in Collecting Data_Math 4-Q4 Week 5.pptx Steps in Collecting Data
_Math 4-Q4 Week 5.pptx Steps in Collecting DataJhengPantaleon
 
URLs and Routing in the Odoo 17 Website App
URLs and Routing in the Odoo 17 Website AppURLs and Routing in the Odoo 17 Website App
URLs and Routing in the Odoo 17 Website AppCeline George
 
Introduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher EducationIntroduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher Educationpboyjonauth
 
Presiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha electionsPresiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha electionsanshu789521
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxiammrhaywood
 
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...Marc Dusseiller Dusjagr
 
The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13Steve Thomason
 
MENTAL STATUS EXAMINATION format.docx
MENTAL     STATUS EXAMINATION format.docxMENTAL     STATUS EXAMINATION format.docx
MENTAL STATUS EXAMINATION format.docxPoojaSen20
 
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdfssuser54595a
 
CARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxCARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxGaneshChakor2
 
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Sapana Sha
 
A Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformA Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformChameera Dedduwage
 
Concept of Vouching. B.Com(Hons) /B.Compdf
Concept of Vouching. B.Com(Hons) /B.CompdfConcept of Vouching. B.Com(Hons) /B.Compdf
Concept of Vouching. B.Com(Hons) /B.CompdfUmakantAnnand
 
mini mental status format.docx
mini    mental       status     format.docxmini    mental       status     format.docx
mini mental status format.docxPoojaSen20
 
Solving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxSolving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxOH TEIK BIN
 
How to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxHow to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxmanuelaromero2013
 
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdfSoniaTolstoy
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...EduSkills OECD
 

Recently uploaded (20)

_Math 4-Q4 Week 5.pptx Steps in Collecting Data
_Math 4-Q4 Week 5.pptx Steps in Collecting Data_Math 4-Q4 Week 5.pptx Steps in Collecting Data
_Math 4-Q4 Week 5.pptx Steps in Collecting Data
 
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdfTataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
 
Model Call Girl in Bikash Puri Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Bikash Puri  Delhi reach out to us at 🔝9953056974🔝Model Call Girl in Bikash Puri  Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Bikash Puri Delhi reach out to us at 🔝9953056974🔝
 
URLs and Routing in the Odoo 17 Website App
URLs and Routing in the Odoo 17 Website AppURLs and Routing in the Odoo 17 Website App
URLs and Routing in the Odoo 17 Website App
 
Introduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher EducationIntroduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher Education
 
Presiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha electionsPresiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha elections
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
 
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
 
The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13
 
MENTAL STATUS EXAMINATION format.docx
MENTAL     STATUS EXAMINATION format.docxMENTAL     STATUS EXAMINATION format.docx
MENTAL STATUS EXAMINATION format.docx
 
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
 
CARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxCARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptx
 
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
 
A Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformA Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy Reform
 
Concept of Vouching. B.Com(Hons) /B.Compdf
Concept of Vouching. B.Com(Hons) /B.CompdfConcept of Vouching. B.Com(Hons) /B.Compdf
Concept of Vouching. B.Com(Hons) /B.Compdf
 
mini mental status format.docx
mini    mental       status     format.docxmini    mental       status     format.docx
mini mental status format.docx
 
Solving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxSolving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptx
 
How to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxHow to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptx
 
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
 

Getting Started with Regular Expressions in MarcEdit

  • 1. Getting Started with Regular Expressions in MarcEdit TERRY REESE HEAD OF DIGITAL INITIATIVES, THE OHIO STATE UNIVERSITY
  • 2. Topics MarcEdit Regular Expression Support Information Understanding .NET Regular Expressions ◦ Major components of the language ◦ Understanding grouping mechanisms and references How Does MarcEdit implement expressions Getting Regular Expression Help
  • 3. MarcEdit Regular Expression Support Functions that presently support regular expressions ◦ Delete Field ◦ Edit Field ◦ Copy Field ◦ Swap Field ◦ Build New Field ◦ Extract/Delete Records ◦ Validation Processing ◦ Linked Data tooling ◦ More…
  • 4. MarcEdit Regular Expression Support When processing regular expressions with MarcEdit, MarcEdit makes entire fields or subfields available for processing ◦ i.e., when processing a delete field function – all data from =[field number] are part of the field that can be queried. MarcEdit’s regular expression by default deals with one field at a time (i.e., regular expressions do not allow you to find data across fields by default) MarcEdit’s Regular Expression Support is defined by Microsoft .NET’s Regular Expression object ◦ This object uses a syntax that looks Perl-like, but has some differences.
  • 5. Microsoft’s Regular Expression language Concepts: ◦ Character escapes ◦ Anchors ◦ Character classes ◦ Grouping ◦ Qualifiers ◦ Substitutions MSDN Documentation: https://msdn.microsoft.com/en- us/library/az24scfc(v=vs.110).aspx PDF Quick Reference: http://download.microsoft.com/download/D/2/4/D240EBF6-A9BA-4E4F- A63F-AEB6DA0B921C/Regular%20expressions%20quick%20reference.pdf
  • 6. How we use Regular Expressions in MarcEdit Your most important parts of the regular expression language are: 1. Character escapes: drn$x## 2. Character Classes [] & [^] 3. Grouping Elements () 4. Anchors: ^$ 5. Quantifiers: *?+{#} 6. Substitutions: $#
  • 7. How Expressions Manifest in MarcEdit Part of understanding regular expressions in MarcEdit, is understanding what data is exposed to the Regular expression engine. Each of MarcEdit’s global edit functions see different levels of data This is important to understand when:  Creating processing strategies  Knowing which global editing function to choose
  • 9. Replace Function Provides:  Access to all field data  Can be processed across fields (lines)  Can do preconditional sorting/evaluation before evaluating for replacement (can search for data in one field, and then perform and action on another if true)  Provides most access to record data for evaluation
  • 11. Add/Delete Function Provides:  Access to all field data from the equal sign to end of line  No option to evaluate across fields  Only available when deleting data
  • 13. Edit Field Data Function Provides:  Access all data after the indicators (no indicator or field data access)  Can be used to break up fields into new fields and do recursive searching
  • 15. Edit Subfield Data Provides:  Only provides access to the defined subfield or control data positions
  • 16. Regular Expression Basics I like to think of regular expressions the same way as I think of diagraming a sentence. http://www.english-grammar- revolution.com/images/puzzler_words_october_2012.jpg
  • 17. Regular Expression Basics I am trying to look at the data I want to replace and break it into its component parts. For example if I wanted to add a period to the 500 if it is missing Source Fields: =500 $aPrime meridians: Greenwich and Washington =500 $aPrime meridians: Greenwich and Washington? Structure: Expression: (=500.*[^W])$
  • 18. Examples Looking at example.txt using the replace function: ◦ Add a period to the 500 if it is missing ◦ Add a $h of cartographic resources between the $a and $c . ◦ Split the 856 into two fields, breaking on the $u.
  • 19. Examples 1 ◦ Add a period to the 500 if it is missing ◦ Find What: (=500.*[^W])$ ◦ Replace With: $1. Explanation: ◦ (=500.*[^W])$ ◦ Searches for the 500, then matches all data in the line, until you get to the final character. It then evaluates the final character to see if it’s a not a word character
  • 20. Example 2 ◦ Add a $h of cartographic resources between the $a and $c . Find What: (=245.{4})($a.*)(/.*) ◦ (=245.{4}) ◦ Match the 245 field with any value in the next 4 characters being valid. ◦ ($a.*) ◦ Select everything within the subfield a ◦ (/$c.*) ◦ Select the / value and the subfield c (and other data) Replace With: $1$2$$h[cartographic resource] $3
  • 21. Example 3 Split the 856 into two fields, breaking on the $u. ◦ Find What: (=856.{4})($u.*[^$])($u.*) ◦ (=856.{4}) ◦ Matches the 856 field ◦ ($u.*[^$]) ◦ Match $u, but stop at the end of the subfield ◦ ($u.*) ◦ Match reminder of field ◦ Replace With: $1$2n=856 41$3
  • 22. Lcase/ucase MarcEdit’s regular expression engine includes to extension functions for dealing with case switching of characters. ◦ lcase & ucase ◦ Usage: (=450.{4})($a.)(.*) ◦ $1$2lcase($3) ◦ Example: Find the 500 with all upper case characters and convert the case of all values but the first letter in the sentence to lower case.
  • 23. Multi-Field Replacements By default, MarcEdit handles one field at a time when doing regular expressions. ◦ However, when you need to do evaluations against multiple fields, you can by adding /m to the end of your replacement in the Replace Function in the MarcEditor ◦ This is a special function added to the MarcEdit regular expression engine
  • 24. Delete Field Function The delete field function exposes all the data in the field to be acted upon as a regular expression. ◦ i.e. =856 .* ◦ So the first value in the Delete Field evaluation is an =, not the subfield data ◦ The reason to do this is to allow for explicit evaluations of indicators.
  • 25. Getting Regular Expression Help The MarcEdit Listserv has a number of regular expression experts that provide a lot of help to users looking for it http://metis3.gmu.edu/cgi-bin/wa?A0=MARCEDIT-L

Editor's Notes

  1. Lcase and ucase