From 8ae170ac6c59ea2a1bf711ac3b6fc632dfe21190 Mon Sep 17 00:00:00 2001 From: Matt Jaffee Date: Tue, 15 May 2018 11:05:36 -0500 Subject: [PATCH] simplify regexes by using backquoted strings to avoid double escapes --- uri.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/uri.go b/uri.go index 7ab606788..5d823d8b6 100644 --- a/uri.go +++ b/uri.go @@ -26,8 +26,8 @@ import ( ) var schemeRegexp = regexp.MustCompile("^[+a-z]+$") -var hostRegexp = regexp.MustCompile("^[0-9a-z.-]+$|^\\[[:0-9a-fA-F]+\\]$") -var addressRegexp = regexp.MustCompile("^(([+a-z]+):\\/\\/)?([0-9a-z.-]+|\\[[:0-9a-fA-F]+\\])?(:([0-9]+))?$") +var hostRegexp = regexp.MustCompile(`^[0-9a-z.-]+$|^\[[:0-9a-fA-F]+\]$`) +var addressRegexp = regexp.MustCompile(`^(([+a-z]+):\/\/)?([0-9a-z.-]+|\[[:0-9a-fA-F]+\])?(:([0-9]+))?$`) // URI represents a Pilosa URI. // A Pilosa URI consists of three parts: