summaryrefslogtreecommitdiffstats
path: root/vespajlib
diff options
context:
space:
mode:
authorHenning Baldersheim <balder@yahoo-inc.com>2019-12-11 10:56:47 -0800
committerGitHub <noreply@github.com>2019-12-11 10:56:47 -0800
commit67f2bd0a7227c5747180cdc9a07aaa26eb39e1bd (patch)
tree86739f6f3f5ecfe22e61ca2cae91ea096265d2d1 /vespajlib
parent161254b00e1189020bfa9fcf3ecc2bdf4dc210bf (diff)
Revert "Allow minus sign at the start of a label."
Diffstat (limited to 'vespajlib')
-rw-r--r--vespajlib/src/main/java/com/yahoo/tensor/TensorAddress.java7
1 files changed, 5 insertions, 2 deletions
diff --git a/vespajlib/src/main/java/com/yahoo/tensor/TensorAddress.java b/vespajlib/src/main/java/com/yahoo/tensor/TensorAddress.java
index 52256293a5b..3812dd26370 100644
--- a/vespajlib/src/main/java/com/yahoo/tensor/TensorAddress.java
+++ b/vespajlib/src/main/java/com/yahoo/tensor/TensorAddress.java
@@ -1,7 +1,10 @@
// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.tensor;
+import com.google.common.base.Joiner;
+
import java.util.Arrays;
+import java.util.Objects;
import java.util.Optional;
import java.util.regex.Pattern;
import java.util.stream.Collectors;
@@ -160,7 +163,7 @@ public abstract class TensorAddress implements Comparable<TensorAddress> {
/** Supports building of a tensor address */
public static class Builder {
- private Pattern labelPattern = Pattern.compile("[-,A-Za-z0-9_@]([A-Z,a-z0-9_@$])*");
+ private Pattern identifierPattern = Pattern.compile("[A-Za-z0-9_]+");
private final TensorType type;
private final String[] labels;
@@ -205,7 +208,7 @@ public abstract class TensorAddress implements Comparable<TensorAddress> {
private void requireIdentifier(String s, String parameterName) {
if (s == null)
throw new IllegalArgumentException(parameterName + " can not be null");
- if ( ! labelPattern.matcher(s).matches())
+ if ( ! identifierPattern.matcher(s).matches())
throw new IllegalArgumentException(parameterName + " must be an identifier or integer, not '" + s + "'");
}