<?xml version="1.0" encoding="UTF-8"?>
<?xml-model href="../sch/tei_all_LEMDO.rng" type="application/xml" schematypens="http://relaxng.org/ns/structure/1.0"?>
<?xml-model href="../sch/tei_all_LEMDO.rng" type="application/xml" schematypens="http://purl.oclc.org/dsdl/schematron"?>
<TEI xmlns="http://www.tei-c.org/ns/1.0" xml:id="learn_regexPreFormed">
   <teiHeader>
      <fileDesc>
         <titleStmt>
            <title type="main">Pre-Formed Regular Expressions</title>
            <respStmt xml:id="odd_JENS1_wtm">
               <resp ref="#wtm">Technical Writer</resp>
               <persName ref="#JENS1">Janelle Jenstad</persName>
            </respStmt>
            <respStmt xml:id="odd_HOUL3_wtm">
               <resp ref="#wtm">Technical Writer</resp>
               <persName ref="#HOUL3">Navarra Houldin</persName>
            </respStmt>
            <respStmt xml:id="odd_GALL2_wtm">
               <resp ref="#wtm">Technical Writer</resp>
               <persName ref="#GALL2">Mahayla Galliford</persName>
            </respStmt>
            <respStmt xml:id="odd_VATC1_wtm">
               <resp ref="#wtm">Technical Writer</resp>
               <persName ref="#VATC1">Nicole Vatcher</persName>
            </respStmt>
            <respStmt xml:id="odd_ELHA1_wtm">
               <resp ref="#wtm">Technical Writer</resp>
               <persName ref="#ELHA1">Tracey El Hajj</persName>
            </respStmt>
            <respStmt xml:id="odd_GALL2_pfr">
               <resp ref="#pfr">Proofreader</resp>
               <persName ref="#GALL2">Mahayla Galliford</persName>
            </respStmt>
            <respStmt xml:id="odd_SEAL1_pfr">
               <resp ref="#pfr">Proofreader</resp>
               <persName ref="#SEAL1">Isabella Seales</persName>
            </respStmt>
            <respStmt>
               <resp ref="#pdr">Project Director</resp>
               <persName ref="#JENS1">Janelle Jenstad</persName>
            </respStmt>
            <respStmt>
               <resp ref="#man">Project Manager</resp>
               <persName ref="#GALL2">Mahayla Galliford</persName>
            </respStmt>
            <respStmt>
               <resp ref="#wtm">Training and Documentation Lead</resp>
               <persName ref="#HOUL3">Navarra Houldin</persName>
            </respStmt>
            <respStmt>
               <resp ref="#man">Assistant Project Manager</resp>
               <persName ref="#SEAB1">Samuel Seaberg</persName>
            </respStmt>
            <respStmt>
               <resp ref="#prg">Programmer</resp>
               <persName ref="#HOLM1">Martin Holmes</persName>
            </respStmt>
            <respStmt>
               <resp ref="#prg">Programmer</resp>
               <persName ref="#NOKH1">Illya Nokhrin</persName>
            </respStmt>
            <respStmt>
               <resp ref="#prg">Programmer</resp>
               <persName ref="#TAKE1">Joey Takeda</persName>
            </respStmt>
            <respStmt>
               <resp ref="#prg">Junior Programmer</resp>
               <persName ref="#ELHA1">Tracey El Hajj</persName>
            </respStmt>
            <sponsor ref="#LEMD1"/>
            <funder>Social Sciences and Humanities Research Council of Canada</funder>
         </titleStmt>
         <editionStmt>
            <p>Released with Linked Early Modern Drama Online 1.0</p>
         </editionStmt>
         <publicationStmt>
            <publisher>University of Victoria on the Linked Early Modern Drama Online Platform</publisher>
            <availability>
               <licence from="2023-12-10" resp="#JENS1" corresp="lemdo.xml"/>
               <p>This file is licensed under a <ref target="https://creativecommons.org/licenses/by-nc-nd/4.0/">CC BY-NC_ND 4.0 license</ref>, which means that it is freely downloadable without permission under the following conditions: (1) credit must be given to the author and LEMDO in any subsequent use of the files and/or data; (2) the content cannot be adapted or repurposed (except in quotations for the purposes of academic review and citation); and (3) commercial uses are not permitted without the knowledge and consent of the editor and LEMDO. This license allows for pedagogical use of the documentation in the classroom.</p>
            </availability>
         </publicationStmt>
         <seriesStmt>
            <p>Linked Early Modern Drama Online</p>
         </seriesStmt>
         <sourceDesc>
            <p>TEI Customization created by <orgName ref="#HOLM1">Martin Holmes</orgName>, <orgName ref="#TAKE1">Joey Takeda</orgName>, and <orgName ref="#JENS1">Janelle Jenstad</orgName>; documentation written by members of the <orgName ref="#LEMD1">LEMDO Team</orgName>
            </p>
         </sourceDesc>
      </fileDesc>
      <profileDesc copyOf="#">
         <textClass>
            <catRef scheme="#emdDocumentTypes" target="TAXO1.xml#ldtBornDigDocumentation"/>
            <catRef scheme="#emdDocumentTypes" target="TAXO1.xml#ldtBornDig"/>
         </textClass>
      </profileDesc>
      <tei:encodingDesc xmlns:tei="http://www.tei-c.org/ns/1.0">
         <p>Encoded in TEI P5 according to the LEMDO Customization and Encoding Guidelines</p>
         <editorialDecl>
            <p>n/a</p>
         </editorialDecl>
         <tei:constraintDecl scheme="schematron" queryBinding="xslt2">
            <sch:ns xmlns:sch="http://purl.oclc.org/dsdl/schematron"
                    prefix="tei"
                    uri="http://www.tei-c.org/ns/1.0"/>
            <sch:ns xmlns:sch="http://purl.oclc.org/dsdl/schematron"
                    prefix="xs"
                    uri="http://www.w3.org/2001/XMLSchema"/>
            <sch:ns xmlns:sch="http://purl.oclc.org/dsdl/schematron"
                    prefix="rng"
                    uri="http://relaxng.org/ns/structure/1.0"/>
            <sch:ns xmlns:sch="http://purl.oclc.org/dsdl/schematron"
                    prefix="rna"
                    uri="http://relaxng.org/ns/compatibility/annotations/1.0"/>
            <sch:ns xmlns:sch="http://purl.oclc.org/dsdl/schematron"
                    prefix="sch"
                    uri="http://purl.oclc.org/dsdl/schematron"/>
            <sch:ns xmlns:sch="http://purl.oclc.org/dsdl/schematron"
                    prefix="sch1x"
                    uri="http://www.ascc.net/xml/schematron"/>
         </tei:constraintDecl>
         <classDecl>
            <taxonomy copyOf="TAXO1.xml#emdDocumentTypes" xml:id="emdDocumentTypes">
               <desc>
                  <term>Document Types</term>
                  <gloss>All documents in LEMDO are either <soCalled>born-digital</soCalled>
                     documents or <soCalled>primary</soCalled> documents. Within those two general
                     categories, LEMDO offers additional ways to categorize a file.</gloss>
               </desc>
               <category copyOf="TAXO1.xml#ldtBornDig" xml:id="ldtBornDig">
                  <catDesc>
                     <term>Born-digital</term>
                     <gloss>Born-digital documents are anything other than primary texts</gloss>
                  </catDesc>
                  <category copyOf="TAXO1.xml#ldtBornDigDocumentation"
                            xml:id="ldtBornDigDocumentation">
                     <catDesc>
                        <term>Documentation</term>
                        <gloss>Encoding and editorial guidelines; programming, processing, and
                           rendering instructions; how-to instructions; element descriptions; and
                           records of remediation.</gloss>
                     </catDesc>
                  </category>
               </category>
            </taxonomy>
            <taxonomy copyOf="TAXO1.xml#emdRespTaxonomy" xml:id="emdRespTaxonomy">
               <desc>
                  <term>Responsibilities</term>
                  <gloss>Responsibilities</gloss>
               </desc>
               <category copyOf="TAXO1.xml#man" xml:id="man">
                  <catDesc>
                     <term>Project Manager</term>
                     <gloss type="emd">A person responsible for managing the LEMDO project or a project within the LEMDO suite of anthologies.</gloss>
                  </catDesc>
               </category>
               <category copyOf="TAXO1.xml#pdr"
                         xml:id="pdr"
                         corresp="http://id.loc.gov/vocabulary/relators/pdr.html">
                  <catDesc>
                     <term>Project Director</term>
                     <gloss type="marc">MARC Code List for Relators definition: A person or
                        organization with primary responsibility for all essential aspects of a
                        project, has overall responsibility for managing projects, or provides
                        overall direction to a project manager.</gloss>
                     <gloss type="emd">LEMDO uses the term project director for the person who
                        directs the LEMDO project. For anthology leads, use pbd.</gloss>
                  </catDesc>
               </category>
               <category copyOf="TAXO1.xml#pfr"
                         xml:id="pfr"
                         corresp="http://id.loc.gov/vocabulary/relators/pfr.html">
                  <catDesc>
                     <term>Proofreader</term>
                     <gloss type="marc">MARC Code List for Relators definition: A person who
                        corrects printed matter.</gloss>
                     <gloss type="emd">LEMDO uses the term proofreader for the person who performs
                        minor corrections to a finalized document, which usually include
                        typographical or rendering fixes. For copy-editing, use
                           <soCalled>resp:edt_cpy</soCalled>.</gloss>
                  </catDesc>
               </category>
               <category copyOf="TAXO1.xml#prg"
                         xml:id="prg"
                         corresp="http://id.loc.gov/vocabulary/relators/prg.html">
                  <catDesc>
                     <term>Programmer</term>
                     <gloss type="marc">MARC Code List for Relators definition: A person, family, or
                        organization responsible for creating a computer program.</gloss>
                     <gloss type="emd">LEMDO usage aligns with that of MARC.</gloss>
                  </catDesc>
               </category>
               <category copyOf="TAXO1.xml#wtm"
                         xml:id="wtm"
                         corresp="http://id.loc.gov/vocabulary/relators/wtm.html">
                  <catDesc>
                     <term>Technical Writer</term>
                     <gloss type="marc">MARC Code List for Relators definition: Writer of Technical
                        Material: A person responsible for writing or compiling documentation of the
                        project’s editorial, encoding, and programming practices.</gloss>
                     <gloss type="emd">LEMDO usage aligns with that of MARC.</gloss>
                  </catDesc>
               </category>
            </taxonomy>
         </classDecl>
      </tei:encodingDesc>
      <revisionDesc status="prgGenerated">
         <change who="#HOLM1" when="2026-09-10">Automatically generated this file by 
                        extracting its content from lemdo.lite.odd.</change>
      </revisionDesc>
   </teiHeader>
   <standOff>
      <listPerson>
         <person xml:id="ELHA1" copyOf="PERS1.xml#ELHA1">
            <persName>
               <reg>Tracey El Hajj</reg>
               <forename>Tracey</forename>
               <surname>El Hajj</surname>
            </persName>
            <note>
               <p>Junior Programmer 2019–2020. Research Associate 2020–2021. Tracey received her PhD from the Department of English at the University of Victoria in the field of Science and Technology Studies. Her research focuses on the <term>algorhythmics</term> of networked communications. She was a 2019–2020 President’s Fellow in Research-Enriched Teaching at UVic, where she taught an advanced course on <title level="a">Artificial Intelligence and Everyday Life.</title> Tracey was also a member of the <title level="m">Map of Early Modern London</title> team, between 2018 and 2021. Between 2020 and 2021, she was a fellow in residence at the Praxis Studio for Comparative Media Studies, where she investigated the relationships between artificial intelligence, creativity, health, and justice. As of July 2021, Tracey has moved into the alt-ac world for a term position, while also teaching in the English Department at the University of Victoria.</p>
            </note>
         </person>
         <person xml:id="GALL2" copyOf="PERS1.xml#GALL2">
            <persName>
               <reg>Mahayla Galliford</reg>
               <forename>Mahayla</forename>
               <surname>Galliford</surname>
            </persName>
            <note>
               <p>Project Manager, 2025-present; Assistant Project Manager, 2024-2025; Research Assistant, 2021-present. Mahayla Galliford (she/her) graduated from the University of Victoria with a BA (honours with distinction) in 2024, and an MA English in 2026. Mahayla’s undergraduate research explored early modern stage directions and civic water pageantry. Her SSHRC-funded MA thesis project focuses on transcribing, editing, and encoding early modern girls’ manuscripts, specifically Lady Rachel Fane’s <title level="m">May Masque</title> in collaboration with LEMDO.</p>
            </note>
         </person>
         <person xml:id="HOLM1" copyOf="PERS1.xml#HOLM1">
            <persName>
               <reg>Martin Holmes</reg>
               <forename>Martin</forename>
               <surname>Holmes</surname>
            </persName>
            <note>
               <p>Martin Holmes has worked as a developer in the UVic’s Humanities Computing and Media Centre for over two decades, and has been involved with dozens of Digital Humanities projects. He has served on the TEI Technical Council and as Managing Editor of the Journal of the TEI. He took over from Joey Takeda as lead developer on LEMDO in 2020. He is a collaborator on the SSHRC Partnership Grant led by Janelle Jenstad.</p>
            </note>
         </person>
         <person xml:id="HOUL3" copyOf="PERS1.xml#HOUL3">
            <persName>
               <reg>Navarra Houldin</reg>
               <forename>Navarra</forename>
               <surname>Houldin</surname>
            </persName>
            <note>
               <p>Training and Documentation Lead 2025–present. LEMDO project manager 2022–2025. Textual remediator 2021–present. Navarra Houldin (they/them) completed their BA with a major in history and minor in Spanish at the University of Victoria in 2022. Their primary research was on gender and sexuality in early modern Europe and Latin America. They are continuing their education through an MA program in Gender and Social Justice Studies at the University of Alberta where they will specialize in Digital Humanities.</p>
            </note>
         </person>
         <person xml:id="JENS1" copyOf="PERS1.xml#JENS1">
            <persName>
               <reg>Janelle Jenstad</reg>
               <forename>Janelle</forename>
               <surname>Jenstad</surname>
            </persName>
            <note>
               <p>Janelle Jenstad is a Professor of English at the University of Victoria, Director of <ref target="https://mapoflondon.uvic.ca">The Map of Early Modern London</ref>, and Director of <ref target="https://lemdo.uvic.ca">Linked Early Modern Drama Online</ref>. With Jennifer Roberts-Smith and Mark Beatrice Kaethler, she co-edited <title level="m">Shakespeare’s Language in Digital Media: Old Words, New Tools</title> (Routledge). She has edited John Stow’s <title level="m">A Survey of London</title> (1598 text) for MoEML and is currently editing <title level="m">The Merchant of Venice</title> (with Stephen Wittek) and Heywood’s <title level="m">2 If You Know Not Me You Know Nobody</title> for DRE. Her articles have appeared in <title level="j">Digital Humanities Quarterly</title>, <title level="j">Elizabethan Theatre</title>, <title level="j">Early Modern Literary Studies</title>, <title level="j">Shakespeare Bulletin</title>, <title level="j">Renaissance and Reformation</title>, and <title level="j">The Journal of Medieval and Early Modern Studies</title>. She contributed chapters to <title level="m">Approaches to Teaching Othello</title> (MLA); <title level="m">Teaching Early Modern Literature from the Archives</title> (MLA); <title level="m">Institutional Culture in Early Modern England</title> (Brill); <title level="m">Shakespeare, Language, and the Stage</title> (Arden); <title level="m">Performing Maternity in Early Modern England</title> (Ashgate); <title level="m">New Directions in the Geohumanities</title> (Routledge); <title level="m">Early Modern Studies and the Digital Turn</title> (Iter); <title level="m">Placing Names: Enriching and Integrating Gazetteers</title> (Indiana); <title level="m">Making Things and Drawing Boundaries</title> (Minnesota); <title level="m">Rethinking Shakespeare Source Study: Audiences, Authors, and Digital Technologies</title> (Routledge); and <title level="m">Civic Performance: Pageantry and Entertainments in Early Modern London</title> (Routledge). For more details, see <ref target="https://janellejenstad.com/">janellejenstad.com</ref>.</p>
            </note>
         </person>
         <person xml:id="NOKH1" copyOf="PERS1.xml#NOKH1">
            <persName>
               <reg>Illya</reg>
               <forename/>
               <surname>Nokhrin</surname>
            </persName>
            <note>
               <p>Illya has a BA in English and Sociocultural Anthropology and an MA in English. Prior to joining the HCMC, he was a PhD candidate in English and Book History at the University of Toronto and worked on <ref target="https://ereed.org/">Records of Early English Drama</ref> and on the <ref target="https://www.modernistarchives.com/">Modernist Archives Publishing Project</ref>. His work at the HCMC focuses on creating web-based applications for research projects led by members of the faculty of Humanities at the University of Victoria. This involves creating schemas for new and existing datasets, writing XSLT and build files to transform datasets into structured TEI and HTML formats, implementing staticSearch, and ensuring that new projects are Endings Principles compliant.
                        </p>
            </note>
         </person>
         <person xml:id="SEAB1" copyOf="PERS1.xml#SEAB1">
            <persName>
               <reg>Samuel Seaberg</reg>
               <forename>Samuel</forename>
               <surname>Seaberg</surname>
            </persName>
            <note>
               <p>Samuel Seaberg, a University of Victoria English undergrad, enjoys riding his bike. During the summer of 2025, he began working with LEMDO as a recipient of the Valerie Kuehne Undergraduate Research Award (VKURA). Unfortunately, due to his summer being spent primarily in working to establish an edition of Thomas Heywood’s <title level="m">If You Know Not Me, You Know Nobody, Part 2</title> and consequently working out how to represent multi-text works in a digital space, his bike has suffered severely of sheltered seclusion from the sun. Note: Samuel now works for LEMDO as the Assistant Project Manager, much to his bike’s chagrin.</p>
            </note>
         </person>
         <person xml:id="SEAL1" copyOf="PERS1.xml#SEAL1">
            <persName>
               <reg>Isabella Seales</reg>
               <forename>Isabella</forename>
               <surname>Seales</surname>
            </persName>
            <note>
               <p>Isabella Seales is a fourth year undergraduate completing her Bachelor of Arts in English at the University of Victoria. She has a special interest in Renaissance and Metaphysical Literature. She is assisting Dr. Jenstad with the MoEML Mayoral Shows anthology as part of the Undergraduate Student Research Award program.</p>
            </note>
         </person>
         <person xml:id="TAKE1" copyOf="PERS1.xml#TAKE1">
            <persName>
               <reg>Joey Takeda</reg>
               <forename>Joey</forename>
               <surname>Takeda</surname>
            </persName>
            <note>
               <p>Joey Takeda is LEMDO’s Consulting Programmer and Designer, a role he assumed in 2020 after three years as the Lead Developer on LEMDO.</p>
            </note>
         </person>
         <person xml:id="VATC1" copyOf="PERS1.xml#VATC1">
            <persName type="cont">
               <reg>Nicole Vatcher</reg>
               <forename>Nicole</forename>
               <surname>Vatcher</surname>
               <abbr>NV</abbr>
            </persName>
            <note>
               <p>Technical Documentation Writer, 2020–2022. Nicole Vatcher completed her BA (Hons.) in English at the University of Victoria in 2021. Her primary research focus was women’s writing in the modernist period.</p>
            </note>
         </person>
      </listPerson>
      <listOrg>
         <org xml:id="LEMD1" copyOf="ORGS1.xml#LEMD1">
            <orgName>
               <reg>LEMDO Team</reg>
            </orgName>
            <note>The LEMDO Team is based at the University of Victoria and normally comprises the project director, the lead developer, project manager, junior developers(s), remediators, encoders, and remediating editors.</note>
         </org>
      </listOrg>
   </standOff>
   <text>
      <body>
         <div ana="audRemediator">
            <div xmlns:lemdo="http://hcmc.uvic.ca/lemdo/ns" xmlns:sch="http://purl.oclc.org/dsdl/schematron" xmlns:teix="http://www.tei-c.org/ns/Examples" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xml:id="learn_regexPreFormed_prior">
               <head>Prior Reading</head>
               <list rend="bulleted">
                  <item>
                     <title level="a"><ref target="learn_regex.xml">Introduction to Regular Expressions</ref></title>
                  </item>
               </list>
            </div>
            <div xmlns:lemdo="http://hcmc.uvic.ca/lemdo/ns" xmlns:sch="http://purl.oclc.org/dsdl/schematron" xmlns:teix="http://www.tei-c.org/ns/Examples" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xml:id="learn_regexPreFormed_allEditionComponents">
               <head>Regex for All Edition Components</head>
               <p>The regular expressions in this section are useful in multiple edition components (e.g., you may use them in annotations and critical paratexts).</p>
               <table>
                  <row role="label">
                     <cell>Rationale</cell>
                     <cell>Find</cell>
                     <cell>Replace With</cell>
                  </row>
                  <row role="data" xml:id="learn_regexPreFormed_replaceQ">
                     <cell>Replaces quotation marks with <ref target="lemdo_spec_q.xml"><gi>q</gi></ref> in converted files.</cell>
                     <cell>
                        <code>"([\w][^"]+)"(([\W])|($))</code> (Note: constrain to <code>text()</code> in the XPath context)</cell>
                     <cell>
                        <code>&lt;q&gt;$1&lt;/q&gt;$2</code>
                     </cell>
                  </row>
                  <row role="data" xml:id="learn_regexPreFormed_replaceHyphen">
                     <cell>LEMDO uses en dashes in date and number ranges. We frequently receive files from editors that contain hyphens. This converts such hyphens to en dashes (without converting the hyphens that occur in the dates that are the values of attributes).</cell>
                     <cell>
                        <code>(\d+)-(\d+)</code> (Note: constrain to <code>text()</code> in the XPath context)</cell>
                     <cell>
                        <code>$1–$2</code>
                     </cell>
                  </row>
               </table>
            </div>
            <div xmlns:lemdo="http://hcmc.uvic.ca/lemdo/ns" xmlns:sch="http://purl.oclc.org/dsdl/schematron" xmlns:teix="http://www.tei-c.org/ns/Examples" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xml:id="learn_regexPreFormed_semiDip">
               <head>Regex for Semi-Diplomatic Transcriptions</head>
               <p>The regular expressions in this section are used in semi-diplomatic transcriptions that were converted from IML.</p>
               <table>
                  <row role="label">
                     <cell>Rationale</cell>
                     <cell>Find</cell>
                     <cell>Replace With</cell>
                  </row>
                  <row role="data" xml:id="learn_regexPreFormed_removeExtraLb">
                     <cell>When you are working with IML-TEI converted texts, you may come across a lot of situations where an <ref target="lemdo_spec_lb.xml"><gi>lb</gi></ref> element appears right inside the <ref target="lemdo_spec_ab.xml"><gi>ab</gi></ref> of a speech, instead of before the <ref target="lemdo_spec_sp.xml"><gi>sp</gi></ref> tag. This removes those unwanted <ref target="lemdo_spec_lb.xml"><gi>lb</gi></ref> elements. Note: we recommend running this regex before adding renditions or making other changes to the file.</cell>
                     <cell>
                        <code>(&lt;sp&gt;\s+&lt;speaker&gt;.+?&lt;/speaker&gt;\s*&lt;ab&gt;\s*)(&lt;lb/&gt;)</code> (Note: make sure you check <quote>Dot matches all</quote>)</cell>
                     <cell>
                        <code>$2$1</code>
                     </cell>
                  </row>
                  <row role="data" xml:id="learn_regexPreFormed_removeEditorialLineNumber">
                     <cell>This removes <ref target="lemdo_spec_lb.xml"><gi>lb</gi></ref> elements with <att>n</att> giving editorial line numbers.</cell>
                     <cell>
                        <code>&lt;lb\s+n="\d*\.*\d*"/&gt;</code>
                     </cell>
                     <cell>Leave empty</cell>
                  </row>
                  <row role="data" xml:id="learn_regexPreFormed_removeOldFacs">
                     <cell>When you convert a file from TCP or IML to TEI, there will likely be old facsimile links in the <ref target="lemdo_spec_pb.xml"><gi>pb</gi></ref> element. This removes old facsimile links.</cell>
                     <cell>
                        <code>(&lt;pb)\sfacs=".+?"(/&gt;)</code>
                     </cell>
                     <cell>
                        <code>$1$2</code>
                     </cell>
                  </row>
                  <row role="data" xml:id="learn_regexPreFormed_correctElementOrderSemiDip">
                     <cell>You may come across instances of the <ref target="lemdo_spec_lb.xml"><gi>lb</gi></ref> element appearing after <ref target="lemdo_spec_sp.xml"><gi>sp</gi></ref> rather than before it. This corrects order of elements.</cell>
                     <cell>
                        <code>(&lt;sp&gt;\s+)(&lt;lb/&gt;\s*)(&lt;speaker&gt;.+?&lt;/speaker&gt;)</code>
                     </cell>
                     <cell>
                        <code>$2$1$3</code>
                     </cell>
                  </row>
                  <row role="data" xml:id="learn_regexPreFormed_standardizeAttributeOrderFW">
                     <cell>Standardizes attribute order on forme works. Note: this regex should be run before running any other regex on forme works.</cell>
                     <cell>
                        <code>&lt;fw(\srendition="(\s*\w+:\w+)+")(\stype="\w+")</code>
                        <note type="editorial">Explanation of find regex: this regex has three backreference groups: <list rend="numbered">
                              <item>
                                 <code>(\srendition="(\s*\w+:\w+)+")</code>: contains the <att>rendition</att> attribute and its value(s)</item>
                              <item>
                                 <code>(\s*\w+:\w+)+</code>: accounts for one or more values on the <att>rendition</att> attribute (note that format for <att>rendition</att> values is <val>rnd:[value]</val>)</item>
                              <item>
                                 <code>(\stype="\w+")</code>: contains the <att>type</att> attribute and its value</item>
                           </list>
                        </note>
                     </cell>
                     <cell>
                        <code>&lt;fw$3$1</code>
                        <note type="editorial">Explanation of replace regex: by putting $3 before $1 in the replace, this regex places the <att>type</att> attribute before the <att>rendition</att> attribute, which will format the <ref target="lemdo_spec_fw.xml"><gi>fw</gi></ref> elements correctly for other regex.</note>
                     </cell>
                  </row>
                  <row role="data" xml:id="learn_regexPreFormed_removeCentreSig">
                     <cell>LEMDO’s default styling is to centre signature numbers. This removes unnecessary <att>rendition</att> attributes that only have the value <val>rnd:centre</val> from signature numbers.</cell>
                     <cell>
                        <code>(&lt;fw type="sig")\srendition="rnd:centre"</code>
                     </cell>
                     <cell>
                        <code>$1</code>
                     </cell>
                  </row>
                  <row role="data" xml:id="learn_regexPreFormed_removeRightCatch">
                     <cell>LEMDO’s default styling is to align catch words to the right. This removes unnecessary <att>rendition</att> attributes that only have the value <val>rnd:right</val> from catch words.</cell>
                     <cell>
                        <code>(&lt;fw type="catch")\srendition="rnd:right"</code>
                     </cell>
                     <cell>
                        <code>$1</code>
                     </cell>
                  </row>
                  <row role="data" xml:id="learn_regexPreFormed_removeSigSpace">
                     <cell>Removes unnecessary space from between the letter and number of signature marks</cell>
                     <cell>
                        <code>(&lt;fw type="sig"&gt;[a-zA-Z]+)\s(\d&lt;/fw&gt;)</code>
                        <note type="editorial">Explanation of find regex: this find has two backreference groups that are kept in the conversion: <list rend="numbered">
                              <item>
                                 <code>(&lt;fw type="sig"&gt;[a-zA-Z]+)</code>: contains the opening <ref target="lemdo_spec_fw.xml"><gi>fw</gi></ref> tag, all of the attributes on it, and the letter of the signature mark.</item>
                              <item>
                                 <code>(\d&lt;/fw&gt;)</code>: contains the number of the signature mark and the closing <tag>/fw</tag> tag.</item>
                           </list>
                           <list rend="bulleted">
                              <item>
                                 <code>&lt;fw type="sig"&gt; … &lt;/fw&gt;</code>: constrains the search to text encoded as signature marks.</item>
                              <item>
                                 <code>[a-zA-Z]+</code>: indicates the letter or letters in the signature mark. They may be capital or lower case letters, and there will be at least one (there may be more than one in long books with lots of gatherings).</item>
                              <item>
                                 <code>\s</code>: indicates the space between the letter and number. This will be removed in the conversion.</item>
                              <item>
                                 <code>\d</code>: indicates the number in the signature mark.</item>
                           </list>
                        </note>
                     </cell>
                     <cell>
                        <code>$1$2</code>
                        <note type="editorial">Explanation of replace regex: <list rend="bulleted">
                              <item>
                                 <code>$1</code>: Keeps the first backreference group during the conversion process.</item>
                              <item>
                                 <code>$2</code>: Keeps the second backreference group during the conversion process.</item>
                           </list> By excluding the <code>\s</code> from the replace, we eliminate the unwanted space.</note>
                     </cell>
                  </row>
                  <row role="data" xml:id="learn_regexPreFormed_removeItalicCentreRunningTitle">
                     <cell>Removes italic and centre tagging from running titles. Note: after running this, always also run the <ref target="#learn_regexPreFormed_removeEmptyRendition">regex to remove empty <att>rendition</att> attributes</ref>.</cell>
                     <cell>
                        <code>(&lt;fw\stype="runningTitle"\srendition=")((\s*rnd:centre)|(\s*rnd:italic)|(\s*(rnd:\w+)))*"</code>
                     </cell>
                     <cell>
                        <code>$1$6"</code>
                     </cell>
                  </row>
                  <row role="data" xml:id="learn_regexPreFormed_removeEmptyRendition">
                     <cell>Removes empty <att>rendition</att> attributes. Note: run this after using regex to remove values from <att>rendition</att> attributes.</cell>
                     <cell>
                        <code>\srendition=""</code>
                     </cell>
                     <cell>Leave empty</cell>
                  </row>
                  <row role="data" xml:id="learn_regexPreFormed_removeItalicCentreHiOnRendition">
                     <cell>Removes italic and centre tagging on <ref target="lemdo_spec_hi.xml"><gi>hi</gi></ref> elements in running titles. Note: after running this, always also run the <ref target="#learn_regexPreFormed_removeEmptyHi">regex to remove empty <gi>hi</gi> elements</ref>.</cell>
                     <cell>
                        <code>(&lt;hi\srendition=")((\s*rnd:centre)|(\s*rnd:italic)|(\s*(rnd:\w+)))*"</code> (Note: constrain to <code>//fw[contains(@type, 'runningTitle')]</code> in the XPath field)</cell>
                     <cell>
                        <code>$1$6</code>
                     </cell>
                  </row>
                  <row role="data" xml:id="learn_regexPreFormed_removeEmptyHi">
                     <cell>Removes empty <ref target="lemdo_spec_hi.xml"><gi>hi</gi></ref> elements after getting rid of values. Note: run this after using regex to remove values from <att>rendition</att> attributes on the <ref target="lemdo_spec_hi.xml"><gi>hi</gi></ref> element.</cell>
                     <cell>
                        <code>&lt;hi\srendition=""&gt;(.+?)&lt;\hi&gt;</code>
                     </cell>
                     <cell>
                        <code>$1</code>
                     </cell>
                  </row>
                  <row role="data" xml:id="learn_regexPreFormed_removeItalicSpeaker">
                     <cell>Removes italic tagging on <ref target="lemdo_spec_speaker.xml"><gi>speaker</gi></ref> elements. Note: after running this, always also run the <ref target="#learn_regexPreFormed_removeEmptyRendition">regex to remove empty <att>rendition</att> attributes</ref>.</cell>
                     <cell>
                        <code>(&lt;speaker\srendition=")((\s*rnd:italic)|(\s*(\w+:\w+)))*"</code>
                     </cell>
                     <cell>
                        <code>$1$5"</code>
                     </cell>
                  </row>
                  <row role="data" xml:id="learn_regexPreFormed_removeItalicAddNormalHiInSpeechPrefix">
                     <cell>Removes italic tagging on <ref target="lemdo_spec_hi.xml"><gi>hi</gi></ref> elements in speech prefixes and adds <ref target="lemdo_spec_hi.xml"><gi>hi</gi></ref> elements with <val>rnd:normal</val> around characters in roman type. Note: after running this, always also run the <ref target="#learn_regexPreFormed_removeEmptyHi">regex to remove empty <gi>hi</gi> elements</ref> and the <ref target="#learn_regexPreFormed_removeHiEmptyTextNode">regex to remove <gi>hi</gi> elements with empty text nodes</ref>.</cell>
                     <cell>
                        <code>(&lt;speaker&gt;)(.+?)*(&lt;hi\srendition=")((\s*rnd:italic)|(\s*(\w+:\w+)))*"&gt;(.+?)*(&lt;/speaker&gt;)</code>
                     </cell>
                     <cell>
                        <code>$1&lt;hi rendition="rnd:normal"&gt;$2&lt;/hi&gt;$3&lt;hi rendition="rnd:normal"&gt;$4&lt;/hi&gt;$5</code>
                     </cell>
                  </row>
                  <row role="data" xml:id="learn_regexPreFormed_removeHiEmptyTextNode">
                     <cell>Removes <ref target="lemdo_spec_hi.xml"><gi>hi</gi></ref> element with empty text nodes.</cell>
                     <cell>
                        <code>&lt;hi\srendition=".+?"&gt;&lt;/hi&gt;</code>
                     </cell>
                     <cell>Leave empty</cell>
                  </row>
                  <row role="data" xml:id="learn_regexPreFormed_standardizeAttributesStage">
                     <cell>Standardizes the order of attributes on the <ref target="lemdo_spec_stage.xml"><gi>stage</gi></ref> element. Note: run this regex before running any other regex on stage directions.</cell>
                     <cell>
                        <code>(&lt;stage)(\srendition="(\s*(\w+:\w+))+")(\stype="(\s*\w+)+")</code>
                     </cell>
                     <cell>
                        <code>$1$5$2</code>
                     </cell>
                  </row>
                  <row role="data" xml:id="learn_regexPreFormed_removeItalicStage">
                     <cell>Removes italic tagging on <ref target="lemdo_spec_stage.xml"><gi>stage</gi></ref> elements. Note: after running this, always also run the <ref target="#learn_regexPreFormed_removeEmptyRendition">regex to remove empty <att>rendition</att> attributes</ref>.</cell>
                     <cell>
                        <code>(&lt;hi\srendition=")((\s*rnd:italic)|(\s*(rnd:\w+)))*"</code> (Note: constrain to <code>//stage</code> in the XPath field)</cell>
                     <cell>
                        <code>$1$5</code>
                     </cell>
                  </row>
                  <row role="data" xml:id="learn_regexPreFormed_removeItalicHiInStage">
                     <cell>Removes italic tagging using the <ref target="lemdo_spec_hi.xml"><gi>hi</gi></ref> element in stage directions. Note: after running this, always also run the <ref target="#learn_regexPreFormed_removeEmptyHi">regex to remove empty <gi>hi</gi> elements</ref>.</cell>
                     <cell>
                        <code>(&lt;hi\srendition=")((\s*rnd:italic)|(\s*(rnd:\w+)))*"</code> (Note: constrain to <code>//stage</code> in the XPath field)</cell>
                     <cell>
                        <code>$1$5"</code>
                     </cell>
                  </row>
                  <row role="data" xml:id="learn_regexPreFormed_removeWho">
                     <cell>Removes <att>who</att> attributes</cell>
                     <cell>
                        <code>&lt;sp who="#\w+"&gt;</code>
                        <note type="editorial">Explanation of find regex: <list rend="bulleted">
                              <item>
                                 <code>&lt;sp&gt;</code>: Constrains the search to <ref target="lemdo_spec_sp.xml"><gi>sp</gi></ref> elements.</item>
                              <item>
                                 <code>who="#\w+"</code>: Searches for the <att>who</att> attribute. This is the section that will be removed during the conversion. The hash character indicates that every value for the <att>who</att> attribute is prefixed by a hash character. <code>\w</code> indicates that the value following the hash character may consist of alphanumeric characters and underscores (word characters). The plus sign indicates that there will be one or more word character.</item>
                           </list>
                        </note>
                     </cell>
                     <cell>
                        <code>&lt;sp&gt;</code>
                     </cell>
                  </row>
                  <row role="data" xml:id="learn_regexPreFormed_removeJustify">
                     <cell>Removes <val>rnd:justify</val>. Note: after running this, always also run the <ref target="#learn_regexPreFormed_removeEmptyHi">regex to remove empty <gi>hi</gi> elements</ref>.</cell>
                     <cell>
                        <code>\srendition="rnd:justify"</code>
                     </cell>
                     <cell>Leave empty</cell>
                  </row>
                  <row role="data" xml:id="learn_regexPreFormed_removeSuppliedPage">
                     <cell>Removes supplied page numbers on the <att>n</att> attribute on the <ref target="lemdo_spec_pb.xml"><gi>pb</gi></ref> element</cell>
                     <cell>
                        <code>(&lt;pb\sn=")\d+;\s(\w+"/&gt;)</code>
                     </cell>
                     <cell>
                        <code>$1$2</code>
                     </cell>
                  </row>
                  <row role="data" xml:id="learn_regexPreFormed_standardizeAttributeOrderLb">
                     <cell>The XSLT conversion to programmatically number lines in semi-diplomatic transcriptions puts the <att>n</att> attribute before the <att>type</att> attribute. While this is valid XML, LEMDO opts for the <att>type</att> attribute to appear before the <att>n</att> attribute. Consistency ensures easy searchability across our repository. This regex reorders the attributes so that they are consistent.</cell>
                     <cell>
                        <code>(&lt;lb)(\sn="\d+")(\stype="wln")(/&gt;)</code>
                     </cell>
                     <cell>
                        <code>$1$3$2$4</code>
                     </cell>
                  </row>
               </table>
            </div>
            <div xmlns:lemdo="http://hcmc.uvic.ca/lemdo/ns" xmlns:sch="http://purl.oclc.org/dsdl/schematron" xmlns:teix="http://www.tei-c.org/ns/Examples" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xml:id="learn_regexPreFormed_modern">
               <head>Regex for Modernized Texts</head>
               <p>The regular expressions in this section are used in modernized texts that were converted from IML.</p>
               <table>
                  <row role="label">
                     <cell>Rationale</cell>
                     <cell>Find</cell>
                     <cell>Replace With</cell>
                  </row>
                  <row role="data" xml:id="learn_regexPreFormed_addDivN">
                     <cell>Adds <att>n</att> attribute to <ref target="lemdo_spec_div.xml"><gi>div</gi></ref> elements</cell>
                     <cell>
                        <code>&lt;div type="(\w+)" xml:id="([a-zA-Z]+_\w*)_([a-z])(\d+)"&gt;</code>
                     </cell>
                     <cell>
                        <code>&lt;div type="$1" n="$4" xml:id="$2_$3$4"&gt;</code>
                     </cell>
                  </row>
               </table>
            </div>
            <div xmlns:lemdo="http://hcmc.uvic.ca/lemdo/ns" xmlns:sch="http://purl.oclc.org/dsdl/schematron" xmlns:teix="http://www.tei-c.org/ns/Examples" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xml:id="learn_regexPreFormed_otherResources">
               <head>Other Resources</head>
               <list rend="bulleted">
                  <item>LEMDO YouTube video: <ref target="https://youtu.be/ncqs5oV25WE">Modernization (Technical): Regular Expressions</ref>
                  </item>
                  <item>Jan Goyvaerts’s <ref target="https://www.regular-expressions.info/">Regular-Expressions.info</ref>
                  </item>
               </list>
            </div>
         </div>
      </body>
   </text>
</TEI>
