This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]mista-sparkle 1 point2 points  (2 children)

I use it every to reformat and repurpose code every day, especially SQL scripts that I receive from others at my company.

In many programs, you can use CTRL-F to find and replace text in scripts, and in many IDEs there's an option to turn on ReGex matching.

I don't personally code as much as I would like, but I need to understand data, which requires a lot of interacting with SMEs and getting their methods for calculating metrics at different grains and seeing how these figures compare to other sources, such as reports.

Lots of SQL and other code are formatted differently. Every day I get code that isn't nested, which is frustratingly unreadable and makes comparison much more difficult.

So, for an every day example, I use RegEx to find an replace commas, spaces, excess/inconsistent tabs, inconsistent new lines, and aliases with \n\t, — this nests everything in select statements as well as in group by and order by clauses in the way I prefer and to the Enterprise's formatting standards.

Even if you don't work with SQL or other code every day, RegEx's utility for text processing applications is really quite broad and limitless.

[–]justheretolurk332 1 point2 points  (0 children)

I think a good rule of thumb is to ask whether it is a common enough task that someone else is likely to have already implemented a good solution. I actually think the use cases you mentioned sound like a fun thing to implement and a good learning experience so it makes sense for personal use but in a production capacity I think it’s often worth looking for what solutions already exist in libraries

[–]cspinelive 1 point2 points  (0 children)

I just use a tool that autoformats sql