Refactoring with Regular Expressions

Review (2024)
Authors

D. Spinellis (Athens University of Economics and Business, TU Delft - Software Engineering)

Research Group
Software Engineering
To reference this document use:
https://doi.org/10.1109/MS.2024.3439028
More Info
expand_more
Publication Year
2024
Language
English
Research Group
Software Engineering
Issue number
6
Volume number
41
Pages (from-to)
29-33
DOI:
https://doi.org/10.1109/MS.2024.3439028
Reuse Rights

Other than for strictly personal use, it is not permitted to download, forward or distribute the text or part of it, without the consent of the author(s) and/or copyright holder(s), unless the work is under an open content license such as Creative Commons.

Abstract

Code refactoring is an essential part of software development, because it reduces technical debt, enhances long-term code sustainability, and enables the implementation of functionality that might have been incompatible with an original design. IDEs automate many refactoring tasks, but they sometimes lack support for specific operations or languages. In such cases, regular expressions offer a powerful alternative, automating tedious tasks, reducing errors, and saving time. This article shares a practical example: extending the CScout refactoring browser to collect metrics on C preprocessor usage, which required addressing widespread cyclic dependencies. The changes were facilitated by the "git-subst"Git extension, which makes global text replacements using regular expressions in Git-managed files. A series of 30 git-subst invocations were automatically generated, again using regular expression replacements. While not a cure-all, regular expressions are invaluable for many refactoring tasks, making them a key skill for software developers.

Files

Refactoring_With_Regular_Expre... (pdf)
(pdf | 1.21 Mb)
- Embargo expired in 07-04-2025
License info not available