aboutsummaryrefslogtreecommitdiff
path: root/formspec.go
diff options
context:
space:
mode:
Diffstat (limited to 'formspec.go')
-rw-r--r--formspec.go10
1 files changed, 5 insertions, 5 deletions
diff --git a/formspec.go b/formspec.go
index 12553f1..a8a1ea2 100644
--- a/formspec.go
+++ b/formspec.go
@@ -5,14 +5,14 @@ import (
"strings"
)
+var textureName = regexp.MustCompile("[a-zA-Z0-9-_.]*\\.[a-zA-Z-_.]+")
+
func (sc *ServerConn) prependFormspec(fs *string) {
- reg := regexp.MustCompile("[^a-zA-Z0-9-_.:]")
- reg2 := regexp.MustCompile("[a-zA-Z0-9-_.]*\\.[a-zA-Z-_.]+")
- subs := reg.Split(*fs, -1)
- seps := reg.FindAllString(*fs, -1)
+ subs := disallowedChars.Split(*fs, -1)
+ seps := disallowedChars.FindAllString(*fs, -1)
for i, sub := range subs {
- if reg2.MatchString(sub) && !strings.Contains(sub, " ") {
+ if textureName.MatchString(sub) && !strings.Contains(sub, " ") {
prepend(sc.name, &subs[i])
}
}