# Useful Regex's for Julia code bases

**URL:** <https://discourse.julialang.org/t/useful-regexs-for-julia-code-bases/24272>\
**Category:** Tooling\
**Tags:** proposal, regex\
**Created:** [May 16, 2019, 9:39am UTC](https://discourse.julialang.org/t/useful-regexs-for-julia-code-bases/24272 "2019-05-16T09:39:48Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![alexmorley](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/alexmorley/32/2722_2.png) [@alexmorley](https://discourse.julialang.org/u/alexmorley)\
**Post date:** [May 16, 2019, 9:39am UTC](https://discourse.julialang.org/t/useful-regexs-for-julia-code-bases/24272/1 "2019-05-16T09:39:48Z")

</div>

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?
