From b0fa067ffc583dd57e8ac5e8772b4a94ec461807 Mon Sep 17 00:00:00 2001 From: Travis Date: Sat, 29 Apr 2017 16:49:23 -0500 Subject: [PATCH] remove the ability to start an Index, Frame, ColumnLabel, or RowLabel with a number --- frame_test.go | 2 ++ pilosa.go | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/frame_test.go b/frame_test.go index a6001e8d2..fc5c01570 100644 --- a/frame_test.go +++ b/frame_test.go @@ -91,6 +91,7 @@ func TestFrame_NameValidation(t *testing.T) { } invalidFrameNames := []string{ "", + "123abc", "x.y", "_foo", "-bar", @@ -131,6 +132,7 @@ func TestFrame_RowLabelValidation(t *testing.T) { "UPPERCASE", } invalidRowLabels := []string{ + "123abc", "x.y", "_foo", "-bar", diff --git a/pilosa.go b/pilosa.go index 6271bd8fa..dd7402677 100644 --- a/pilosa.go +++ b/pilosa.go @@ -47,10 +47,10 @@ var ( ) // Regular expression to validate index and frame names. -var nameRegexp = regexp.MustCompile(`^[a-z0-9][a-z0-9_-]{0,64}$`) +var nameRegexp = regexp.MustCompile(`^[a-z][a-z0-9_-]{0,64}$`) // Regular expression to validate row and column labels. -var labelRegexp = regexp.MustCompile(`^[A-Za-z0-9][A-Za-z0-9_-]{0,64}$`) +var labelRegexp = regexp.MustCompile(`^[A-Za-z][A-Za-z0-9_-]{0,64}$`) // ColumnAttrSet represents a set of attributes for a vertical column in an index. // Can have a set of attributes attached to it.