Today in work I got a nice task.
Should Transform to:
Because I love experimenting with Regular Expressions. I happily dropped everything and started looking for solution . This seemed pretty simple … but … i had to spent like 30 min to find it.
Most important part of this solution is (?!.*min) . This expression will try to look for min word in matched data and if it wont find it there whole match is discarded.
For further replacement procedure, I m specifying two matched groups that will be used to construct new Path. (?
Replace expression uses matched groups like simple variables to construct new Path.
The end result is
Making RegExp is like scientific discovery or complex mathematic problem. You have to really think a lot to find a nice solution.
For experiments I recommendTweet