4 ms·
I recently had to fix some copy and pasted code across 11 files. So I write a regex something like /(.*?)somefunc\((.*?)\) {\n( *?)return a + b;/$1somefunc
by gfxgirl 6y ago
I recently had to fix some copy and pasted code across 11 files. So I write a regex something like
/(.*?)somefunc\((.*?)\) {\n( *?)return a + b;/$1somefunc($2) {\n$3return a * b;/
And then search and replaced across the 11 files. I have no idea how I'd do that with a visual programming environment. I actually needed to do that about 7 times with different regular expressions to do all the refactoring.
Also did this yesterday. I `ls` some folder. It gives me a list of 15 .jpg files. I copy and paste those 15 filenames into my editor, then put a cursor on each line and transform each line into code and HTML (did both). Again, not sure I how I do that in a visual programming environment.
- Firadeoclus 6y agoYou could do that in pretty much the same way, i.e. you create a visual regex. The one difference is that regexes simply match characters, no matter the structure of the code, whereas in a visual language you'd make a distinction between structure and content.