When reading up on functional programming I've stumbled upon the concept of Higher Order Functions which are, as far as I understand, functions that take functions as arguments and/or return functions as their result.
Is there an equivalent to this in the world of Regular Expressions? A Regex that operates on a Regex as to return a different Regex?
A simple (but useless) example would be:
(\w)+(?=\(er\|re\))
matches against
cent(er|re)
replacing the match with
calib
resulting in the Regex
calib(er|re)
Has anyone see this used anywhere? Can anyone think of a situation where this would be useful?