Maintenance

  • Home
  • Log in
  • « Linguistics recording setup
  • Get latest tag version from git repo »

Process oXygen XPath with regex

Posted by gregster on 15 May 2015 in Announcements

This entry is to help me next time I need to do the same thing.

I frequently run XPath in oXygen to find stuff. For example, I just wanted to find all the non-conformant xml:id attributes in a file. So, I used this XPath expression to find them:

//person[matches(@xml:id,'[a-z]{5}')

and it responded with output like this:

System ID: /path/to/my/file/FILENAME.xml
Description: xml:id="feefifofum_3"
XPath location: /TEI[1]/text[1]/body[1]/div[1]/listPerson[2]/person[166]
Start location: 1703:21
End location: 1708:30

ad nauseam

I'm only interested in the actual xml:id value (feefifofum_3) so I ran this regex:

^System.*\nDescription: xml:id="(.*)?".*\n.*\n(^Start.*\n)?(^End.*\n)?

and replaced the match with the first group \1 (or $1 in oXygen)

This entry was posted by Greg and filed under Announcements.

Maintenance

This blog is the location for all work involving software and hardware maintenance, updates, installs, etc., both routine and urgent.
  • Home
  • Recently
  • Archives
  • Categories

Search

Categories

  • All
  • Announcements
  • Hit by a bus
  • Labs
    • Activity log
    • Documentation
  • Notes
  • R & D
    • Activity log
    • Documentation
  • Servers
    • Activity log
    • Documentation
  • Tasks

All blogs

  • Academic
  • AdaptiveDB
  • Admin
  • Announcements
  • CanMys
  • Cascade
  • CGWP
  • ColDesp
  • Depts
  • DVPP
  • Endings
  • HCMC Blogs
  • Landscapes
  • LEMDO
  • Linguistics
  • Maint
  • LondonMap
  • Mariage
  • MoM
  • Moses
  • Pro-D
  • Projects
  • ScanCan
  • HumsSites
  • Wendat

This collection ©2022 by admin • Help • Community software