Go: Replace String with Regular Expression Callback

Image for post
Image for post

Go has many tools for regular expressions available in the default regex package. However, let’s see if you can pick up the pattern…

All the individual mechanics that need to come together exist in the Go regexpackage but they need to be strung together:

And here is a working example:

So finally, it can join the list!

Originally published at http://elliot.land on March 12, 2016.

Written by

I’m a data nerd and TDD enthusiast originally from Sydney. Currently working for Uber in New York. My thoughts here are my own. 🤓 elliotchance@gmail.com

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store