Pre-Formed Regular Expressions
Regex for All Edition Components
The regular expressions in this section are useful in multiple edition components
(e.g., you may use them in annotations and critical paratexts).
| Rationale | Find | Replace With |
Replaces quotation marks with
<q>
in converted files. |
"([\w][^"]+)"(([\W])|($)) (Note: constrain to text() in the XPath context) |
<q>$1</q>$2
|
| 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). |
(\d+)-(\d+) (Note: constrain to text() in the XPath context) |
$1–$2
|
Regex for Semi-Diplomatic Transcriptions
The regular expressions in this section are used in semi-diplomatic transcriptions
that were converted from IML.
| Rationale | Find | Replace With |
When you are working with IML-TEI converted texts, you may come across a lot of situations
where an
<lb>
element appears right inside the
<ab>
of a speech, instead of before the
<sp>
tag. This removes those unwanted
<lb>
elements. Note: we recommend running this regex before adding renditions or making
other changes to the file. |
(<sp>\s+<speaker>.+?</speaker>\s*<ab>\s*)(<lb/>) (Note: make sure you check Dot matches all) |
$2$1
|
This removes
<lb>
elements with
@n giving editorial line numbers. |
<lb\s+n="\d*\.*\d*"/>
|
Leave empty |
When you convert a file from TCP or IML to TEI, there will likely be old facsimile
links in the
<pb>
element. This removes old facsimile links. |
(<pb)\sfacs=".+?"(/>)
|
$1$2
|
You may come across instances of the
<lb>
element appearing after
<sp>
rather than before it. This corrects order of elements. |
(<sp>\s+)(<lb/>\s*)(<speaker>.+?</speaker>)
|
$2$1$3
|
| Standardizes attribute order on forme works. Note: this regex should be run before running any other regex on forme works. |
<fw(\srendition="(\s*\w+:\w+)+")(\stype="\w+")
1
|
<fw$3$1
2
|
LEMDO’s default styling is to centre signature numbers. This removes unnecessary
@rendition attributes that only have the value "rnd:centre" from signature numbers. |
(<fw type="sig")\srendition="rnd:centre"
|
$1
|
LEMDO’s default styling is to align catch words to the right. This removes unnecessary
@rendition attributes that only have the value "rnd:right" from catch words. |
(<fw type="catch")\srendition="rnd:right"
|
$1
|
| Removes unnecessary space from between the letter and number of signature marks |
(<fw type="sig">[a-zA-Z]+)\s(\d</fw>)
3
|
$1$2
4
|
Removes italic and centre tagging from running titles. Note: after running this, always
also run the regex to remove empty
@rendition attributes. |
(<fw\stype="runningTitle"\srendition=")((\s*rnd:centre)|(\s*rnd:italic)|(\s*(rnd:\w+)))*"
|
$1$6"
|
Removes empty
@rendition attributes. Note: run this after using regex to remove values from
@rendition attributes. |
\srendition=""
|
Leave empty |
Removes italic and centre tagging on
<hi>
elements in running titles. Note: after running this, always also run the regex to remove empty
<hi>
elements. |
(<hi\srendition=")((\s*rnd:centre)|(\s*rnd:italic)|(\s*(rnd:\w+)))*" (Note: constrain to //fw[contains(@type, 'runningTitle')] in the XPath field) |
$1$6
|
Removes empty
<hi>
elements after getting rid of values. Note: run this after using regex to remove
values from
@rendition attributes on the
<hi>
element. |
<hi\srendition="">(.+?)<\hi>
|
$1
|
Removes italic tagging on
<speaker>
elements. Note: after running this, always also run the regex to remove empty
@rendition attributes. |
(<speaker\srendition=")((\s*rnd:italic)|(\s*(\w+:\w+)))*"
|
$1$5"
|
Removes italic tagging on
<hi>
elements in speech prefixes and adds
<hi>
elements with "rnd:normal" around characters in roman type. Note: after running this, always also run the regex to remove empty
<hi>
elements and the regex to remove
<hi>
elements with empty text nodes. |
(<speaker>)(.+?)*(<hi\srendition=")((\s*rnd:italic)|(\s*(\w+:\w+)))*">(.+?)*(</speaker>)
|
$1<hi rendition="rnd:normal">$2</hi>$3<hi rendition="rnd:normal">$4</hi>$5
|
Removes
<hi>
element with empty text nodes. |
<hi\srendition=".+?"></hi>
|
Leave empty |
Standardizes the order of attributes on the
<stage>
element. Note: run this regex before running any other regex on stage directions. |
(<stage)(\srendition="(\s*(\w+:\w+))+")(\stype="(\s*\w+)+")
|
$1$5$2
|
Removes italic tagging on
<stage>
elements. Note: after running this, always also run the regex to remove empty
@rendition attributes. |
(<hi\srendition=")((\s*rnd:italic)|(\s*(rnd:\w+)))*" (Note: constrain to //stage in the XPath field) |
$1$5
|
Removes italic tagging using the
<hi>
element in stage directions. Note: after running this, always also run the regex to remove empty
<hi>
elements. |
(<hi\srendition=")((\s*rnd:italic)|(\s*(rnd:\w+)))*" (Note: constrain to //stage in the XPath field) |
$1$5"
|
Removes
@who attributes |
<sp who="#\w+">
5
|
<sp>
|
Removes "rnd:justify". Note: after running this, always also run the regex to remove empty
<hi>
elements. |
\srendition="rnd:justify"
|
Leave empty |
Removes supplied page numbers on the
@n attribute on the
<pb>
element |
(<pb\sn=")\d+;\s(\w+"/>)
|
$1$2
|
The XSLT conversion to programmatically number lines in semi-diplomatic transcriptions
puts the
@n attribute before the
@type attribute. While this is valid XML, LEMDO opts for the
@type attribute to appear before the
@n attribute. Consistency ensures easy searchability across our repository. This regex
reorders the attributes so that they are consistent. |
(<lb)(\sn="\d+")(\stype="wln")(/>)
|
$1$3$2$4
|
Regex for Modernized Texts
The regular expressions in this section are used in modernized texts that were converted
from IML.
| Rationale | Find | Replace With |
Adds
@n attribute to
<div>
elements |
<div type="(\w+)" xml:id="([a-zA-Z]+_\w*)_([a-z])(\d+)">
|
<div type="$1" n="$4" xml:id="$2_$3$4">
|
Other Resources
LEMDO YouTube video: Modernization (Technical): Regular Expressions
Jan Goyvaerts’s Regular-Expressions.info
Notes
1.Explanation of find regex: this regex has three backreference groups:
↑
(\srendition="(\s*\w+:\w+)+"): contains the
@rendition attribute and its value(s)(\s*\w+:\w+)+: accounts for one or more values on the
@rendition attribute (note that format for
@rendition values is "rnd:[value]")(\stype="\w+"): contains the
@type attribute and its value2.Explanation of replace regex: by putting $3 before $1 in the replace, this regex places
the
@type attribute before the
@rendition attribute, which will format the
<fw>
elements correctly for other regex.↑3.Explanation of find regex: this find has two backreference groups that are kept in
the conversion:
↑
(<fw type="sig">[a-zA-Z]+): contains the opening
<fw>
tag, all of the attributes on it, and the letter of the signature mark.(\d</fw>): contains the number of the signature mark and the closing </fw> tag.<fw type="sig"> … </fw>: constrains the search to text encoded as signature marks.[a-zA-Z]+: 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).\s: indicates the space between the letter and number. This will be removed in the conversion.\d: indicates the number in the signature mark.4.Explanation of replace regex:
By excluding the
$1: Keeps the first backreference group during the conversion process.$2: Keeps the second backreference group during the conversion process.\s from the replace, we eliminate the unwanted space.↑5.Explanation of find regex:
↑
<sp>: Constrains the search to
<sp>
elements.who="#\w+": Searches for the
@who attribute. This is the section that will be removed during the conversion. The hash
character indicates that every value for the
@who attribute is prefixed by a hash character. \w 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.Prosopography
Illya
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 Records of Early English Drama and on the Modernist Archives Publishing Project. 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.
Isabella Seales
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.
Janelle Jenstad
Janelle Jenstad is a Professor of English at the University of Victoria, Director
of The Map of Early Modern London, and Director of Linked Early Modern Drama Online. With Jennifer Roberts-Smith and Mark Beatrice Kaethler, she co-edited Shakespeare’s Language in Digital Media: Old Words, New Tools (Routledge). She has edited John Stow’s A Survey of London (1598 text) for MoEML and is currently editing The Merchant of Venice (with Stephen Wittek) and Heywood’s 2 If You Know Not Me You Know Nobody for DRE. Her articles have appeared in Digital Humanities Quarterly, Elizabethan Theatre, Early Modern Literary Studies, Shakespeare Bulletin, Renaissance and Reformation, and The Journal of Medieval and Early Modern Studies. She contributed chapters to Approaches to Teaching Othello (MLA); Teaching Early Modern Literature from the Archives (MLA); Institutional Culture in Early Modern England (Brill); Shakespeare, Language, and the Stage (Arden); Performing Maternity in Early Modern England (Ashgate); New Directions in the Geohumanities (Routledge); Early Modern Studies and the Digital Turn (Iter); Placing Names: Enriching and Integrating Gazetteers (Indiana); Making Things and Drawing Boundaries (Minnesota); Rethinking Shakespeare Source Study: Audiences, Authors, and Digital Technologies (Routledge); and Civic Performance: Pageantry and Entertainments in Early Modern London (Routledge). For more details, see janellejenstad.com.
Joey Takeda
Joey Takeda is LEMDO’s Consulting Programmer and Designer, a role he assumed in 2020
after three years as the Lead Developer on LEMDO.
Mahayla Galliford
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 May Masque in collaboration with LEMDO.
Martin Holmes
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.
Navarra Houldin
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.
Nicole Vatcher
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.
Samuel Seaberg
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 If You Know Not Me, You Know Nobody, Part 2 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.
Tracey El Hajj
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 algorhythmics of networked communications. She was a 2019–2020 President’s Fellow in Research-Enriched
Teaching at UVic, where she taught an advanced course on
Artificial Intelligence and Everyday Life.Tracey was also a member of the Map of Early Modern London 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.
Orgography
LEMDO Team (LEMD1)
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.
Metadata
| Authority title | Pre-Formed Regular Expressions |
| Type of text | Documentation |
| Publisher | University of Victoria on the Linked Early Modern Drama Online Platform |
| Series | Linked Early Modern Drama Online |
| Source |
TEI Customization created by Martin Holmes, Joey Takeda, and Janelle Jenstad; documentation written by members of the LEMDO Team
|
| Editorial declaration | n/a |
| Edition | Released with Linked Early Modern Drama Online 1.0 |
| Encoding description | Encoded in TEI P5 according to the LEMDO Customization and Encoding Guidelines |
| Document status | prgGenerated |
| Funder(s) | Social Sciences and Humanities Research Council of Canada |
| License/availability |
This file is licensed under a CC BY-NC_ND 4.0 license, 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.
|