4 ms·
>> Do you use it for text transformation? Mostly, yes. How often do you search and/or replace and/or extract text? Now imagine doing it while being able to s
by lelele 5y ago
>> Do you use it for text transformation?
Mostly, yes. How often do you search and/or replace and/or extract text? Now imagine doing it while being able to specify patterns instead of just fixed text.
A couple examples:
- find all occurrences of some text only when near some other text, no matter the intervening text;
- transform calls to a routine to calls to another routine, while swapping arguments.
As for other tools, once you know them, you will find ways to use them.
Yes, their syntax can be difficult to remember, but most of the time you are going to use just a few patterns and will learn them by rote memorization. They will become second nature, and indeed I myself am sometimes surprised by the complexity of patterns that I write without thinking about it. Anyway, I recommend that you have handy a plugin for your text editor that highlights matches, to help in troubleshooting buggy regexes when they get convoluted.