Monday Minutes: Using Regex in Batch Item Modification

During this week's Monday Minutes, Enica, a data migration specialist joins us to discuss Regex and how this can help during batch item modifications.

What is 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 wanting to alter a field but not completely remove the rest of the contents.

There are some great resources for learning Regex:

Regex

Regex 101

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 any of the fields.

Not all fields will have the "regex" option available. Specifically, fields that are connected to an Authorized Value, such as Item Type, Shelving Location, Collection Code.

The two examples we discussed in the tutorial video were adding further text to an already used note.

1. One example, 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.

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. The other example would be 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".

Please let us know if we can help you with any regex modifications, we are happy to assist and love to see what our partners are using these fun tools for!

Save the Date!

We will be hosting a live YouTube Live session on Tuesday, August 10th at 11 am EST, where we will SQUASH SOME BUGS!!!! Come in and chat with us and ask questions any time during this two-hour live event.

For more information see this blog post:

Koha Bugsquashing Bonanza

Read more by Kelly McElligott

Tags tools, batch item