Bug 29014

Summary: Unable to use full fledged Regular Expression with capture groups and repalce capability in MARC Modification Template Action Builder.
Product: Koha Reporter: T. Jogi Raju <rajujogi.t>
Component: ToolsAssignee: Bugs List <koha-bugs>
Status: RESOLVED DUPLICATE QA Contact: Testopia <testopia>
Severity: enhancement    
Priority: P5 - low    
Version: 20.11   
Hardware: All   
OS: All   
Change sponsored?: --- Patch complexity: ---
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
Circulation function:

Description T. Jogi Raju 2021-09-14 13:16:29 UTC
The RegEx used in MARC Modification Template Action Builder does merely help to replace the value copied into a field/subfield from another MARK field/subfield with some text (user specified). It also allows to add some prefixes or suffixes to the value. However, it is not possible to replace the value with first few characters of the value. It is also not possible to change the case to UPPER or LOWER case. 

For this to work RegEx should allow for using capture groups and replacing the value with the captured part of the value. For converting to upper or lower case it should also allow for using utility modifiers such as \U (UPPER entire), \L (lower entire), \u (UPPER first character), \l (lower first character).

For example if we want to copy only the first 3 characters from the author (100$a) subfield into Dewey (082$b) subfield and convert the case to UPPER case, we should be able to specify RegEx like this 's/^([a-z]{3}]).*$/\U$1/ig' and get the job done.

Intended result of applying this MARC modification template to a biblio record :

MARC Modification Template Action: 
copy first 100$a to 082$b and replace the value with RegEx: 
  's/^([a-z]{3}]).*$/\U$1/ig'

Record before applying :
	100$a  - Akbar
	082$b  - some entry already existing or empty

Record after applying modification template: 
	100$a  - Akbar	
	082$b  - AKB
Comment 1 Katrin Fischer 2022-02-19 18:38:20 UTC

*** This bug has been marked as a duplicate of bug 23873 ***