fixed a bug with escaped characters
diff --git a/doublestar_test.go b/doublestar_test.go
index 1367a20..9aff41f 100644
--- a/doublestar_test.go
+++ b/doublestar_test.go
@@ -110,6 +110,7 @@
 	{"a/**/c", "a/b/c", true, nil, false, true, 2, 2},
 	{"a/**/d", "a/b/c/d", true, nil, false, true, 1, 1},
 	{"a/\\**", "a/b/c", false, nil, false, !onWindows, 0, 0},
+	{"a/\\[*\\]", "a/bc", false, nil, true, !onWindows, 0, 0},
 	// this is an odd case: filepath.Glob() will return results
 	{"a//b/c", "a/b/c", false, nil, true, false, 0, 0},
 	{"a/b/c", "a/b//c", false, nil, true, true, 1, 1},
diff --git a/match.go b/match.go
index 9145c40..5fef2cd 100644
--- a/match.go
+++ b/match.go
@@ -239,6 +239,11 @@
 				patRune, patRuneLen := utf8.DecodeRuneInString(pattern[patIdx:])
 				nameRune, nameRuneLen := utf8.DecodeRuneInString(name[nameIdx:])
 				if patRune != nameRune {
+					if separator != '\\' && patIdx > 0 && pattern[patIdx-1] == '\\' {
+						// if this rune was meant to be escaped, we need to move patIdx
+						// back to the backslash before backtracking or validating below
+						patIdx--
+					}
 					break
 				}
 
diff --git a/validate.go b/validate.go
index c54ffb9..c689b9e 100644
--- a/validate.go
+++ b/validate.go
@@ -52,7 +52,7 @@
 			}
 
 			for ; i < l; i++ {
-				if s[i] == '\\' {
+				if separator != '\\' && s[i] == '\\' {
 					i++
 				} else if s[i] == ']' {
 					// looks good