From: miettinen Date: Fri, 25 Jan 2013 11:24:22 +0000 (+0000) Subject: Disallowing variable names beginning with a number (refs #3939 #3945). X-Git-Tag: simantics-1.10.1~58 X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=commitdiff_plain;h=a9b73b89c3a60e4cd5935c225a2bdb81e8749293;p=simantics%2Fsysdyn.git Disallowing variable names beginning with a number (refs #3939 #3945). git-svn-id: https://www.simantics.org/svn/simantics/sysdyn/trunk@26681 ac1ea38d-2e2b-0410-8846-a27921b304fc --- diff --git a/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/utils/VariableNameUtils.java b/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/utils/VariableNameUtils.java index c551ab8a..344a0963 100644 --- a/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/utils/VariableNameUtils.java +++ b/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/utils/VariableNameUtils.java @@ -189,7 +189,7 @@ public class VariableNameUtils { */ public static boolean isValid(String name) { String lowerCase = name.toLowerCase(); - Pattern p = Pattern.compile("[a-zA-Z0-9]++"); + Pattern p = Pattern.compile("[a-zA-Z][a-zA-Z0-9]*+"); Matcher m = p.matcher(lowerCase); if (!m.matches() || keywords.contains(name)) return false;