Example replaces bX where X is some number to b'X'

package main

import (
    "fmt"
    "regexp"
)

const sample = `a1 b231 c3 b13 g1`

func main() {
    var re = regexp.MustCompile(`b(\d+)`)
    s := re.ReplaceAllString(sample, `b'$1'`)
    fmt.Println(s)
}

Result:

a1 b'231' c3 b'13' g1