Regex in Koha

Regex

A regular expression (shortened as Regex or Regexp) is a sequence of characters that specifies a search pattern. Usually, such patterns are used by string-searching algorithms for "find" or "find and replace" operations on strings, or for input validation.

In Koha, with Regex, a replacement can be inserted into a Koha item field. This will be helpful when you want to alter a field but not completely remove the rest of the contents.

Batch Item Modification

Within the Batch Item Modification (found in the Tools module), Koha has the ability to use Regex to alter the contents of many of the fields.


Not all fields will have the "Regex" option available. Specifically, those fields that are connected to an authorized value, such as Item type, Shelving location, Collection code.

Monday Minutes: Using Regex in Batch Item Modification


Examples

The two examples discussed in the tutorial video involve adding further text to an already used note.
  1. Example 1: If a library had a public/nonpublic note attached to items, but wanted to add more text. Using Regex would allow adding the new text to either the beginning of the field or at the end of the already existing text.
    1. To add the text to the end of the already existing text, click the 'Regex' option next to that specific field, then in the s/ text box, add a $. In the next box, / you will add the text.
  2. Example 2: Replacing the $ with the ^ - which would put the new text in front of the already existing text.
Another great way to use the Regex option in Batch Item Modification would be to only replace a section of the already existing text. For example, if a library used their 'Materials Specified' field to tell a staff member to "take the item to Carol" - but now needed it to say "take the item to Barbara", we could use Regex to find the word "Carol" and replace it with "Barbara".
    • Related Articles

    • Batch Item Modification

      The Batch Item Modification tool can be found in the Cataloging module. This tool allows libraries to make batch edits to item holding data in a quick and easy way. There are a few ways that a library can use this tool. It can be used either directly ...
    • Labels in Koha

      There are a number of options for creating labels in Koha. Label Creator Koha's label creator tool allows libraries to use layouts and templates in the creation of spine labels and barcodes for printing. A library can create customized label layouts, ...
    • Cataloging Concerns

      This feature can be set up for either staff or OPAC (or both!) and will allow staff and/or patrons to report issues with catalog records. The reported concerns will be visible in the dashboard on the main page of the staff interface and available ...
    • Monograph Cataloging

      Monograph cataloging is used to catalog a non-serial publication contained in one volume (book) that may be part of a set. Harry Potter could be cataloged as a monograph set with volumes, though monographs are typically academic titles containing ...
    • Fast Add Cataloging

      Within the Cataloging module, an option to utilize the Fast Add option appears. Fast Add cataloging is useful in a few ways. Many libraries use Fast Add for their ILL process. Academic Libraries may use Fast Add when adding in faculty-owned material ...