4 ms·
To be fair, a search and replace for "dialog" would also match patterns like, y'know, "dialogue" too, at least in all the naive replace-all algos I've seen in I
by bmelton 13y ago
To be fair, a search and replace for "dialog" would also match patterns like, y'know, "dialogue" too, at least in all the naive replace-all algos I've seen in IDEs.
So, the traditional CTRL+F, or :%s/dialog/dialogue/g would have resulted in at least some instances of 'dialoguegue' as a result. Yeah, the obvious remedy there is :%s/guegue/gue/g, but that too could lead to unintended results, etc.
Not that I don't agree with the intent of your statement, search and replace across 20k lines of code, over however many files, is likely a more involved process than it sounds like.
- nitrogen 13y agoMaybe some thing like s/dialog\([^u]|$\)/dialogue\1/g Or use variable renaming in an IDE that actually parses the code.
- Crito 13y agoTo match dialog but not dialogue in vim: dialog\> ...in other regex systems: dialog\b "dialog" as part of a variable name with underscores: :%s/dialog_/dialogue_/g "dialog" as part of a variable name with CamelCase: :%s/\([dD]\)ialog\([A-Z][A-z]*\)/\1ialogue\2/g You don't need to capture every case in a single regex substitution, you can use a handful to cover pretty much every case though. This sort of change should not take more than a few minutes max of developer time. I don't have experience with them, but I imagine an IDE with refactoring support should make these sort of changes trivial.
- deleted 13y ago[deleted]
- arghbleargh 13y agoYou can always replace dialoguegue with dialogue again afterwards.
- nailer 13y agoOr use an AST and do a structural replace, rather than use text.