Useful Regex's for Julia code bases

I know there are deprecation specific tools but I quite often still find myself spending a little time writing regex’s to update a whole bunch of code with a new/updated syntax, or just when I decide I want to use a different style.

I thought this might be a good place where people could share some they’ve found useful.

E.g.

For renaming all getObject calls to the new PyCall/PyPlot API:
regex: s/\[\:\([a-z_]\+\)\]/\.\1/
e.g: ax[:plot](1,1) becomes ax.plot(1,1)

For updating round calls from julia 0.7 to 1.0:
regex: s/round(\([^,]\+,\)/round(\1 digits=/
e.g: round(maximum([x;y]).+0.01, 2) becomes round(maximum([x;y]).+0.01, digits=2)

Anyone else got useful ones?

2 Likes