in reply to Re^3: How to remove everything after last occurrence of a string?
in thread How to remove everything after last occurrence of a string?
It comes down to choosing the right tool for the task at hand. That is an art in itself. Often a regex is the right tool to solve a tricky matching problem. Sometimes something like index is the tool to use for a simple matching problem or where speed is critical. My main point is that raw execution speed should not be the first consideration when choosing tools to solve a problem. Demonstrable correctness and maintainability should come first and often go hand in hand. At this point the discussion doesn't have much to do with the OP or the specific implementation of any reply.
My reply was addressing what could be seen as a "speed first" approach to coding being advocated by kcott's reply. Ken is an experienced coder so he can skip a few iterations ahead to get a solution that is both clean and quick. That is something that comes with experience, often bitter, so I thought a heads up for the less experienced was in order.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^5: How to remove everything after last occurrence of a string?
by eyepopslikeamosquito (Archbishop) on Jun 08, 2022 at 09:49 UTC |