Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.Sign up
GitHub is where the world builds software
Millions of developers and companies build, ship, and maintain their software on GitHub — the largest and most advanced development platform in the world.
regexp: simple Ruby regular expression doesn’t work #3451
I’ve been slowly working on migrating more of Heroku’s codebase over to Go. One of my more Ruby-centric coworkers just wasted several hours today on Go’s lack of support for this regular expression: var validRequest = regexp.MustCompile(`^/customer/(\w+)/(\w+)?authas=\1(&.*)?`) After tweaking, I’ve narrowed it down to this minimal repro case: var r = regexp.MustCompile(`^(a).+\1`) That works fine in Ruby: $ irb >> "abba".match(/^(a).+\1/) => #<MatchData "abba" 1:"a"> Why doesn’t this work in Go? Not to look a gift horse in the mouth, but I’ll have a harder time getting co-workers to adopt Go if such basic things from Ruby aren’t even supported.