"var-1" is divided incorrectly into "var" and "-1"
See original GitHub issueIn Python mode (not sure whether this bug also exist in other language), var-1
should be divided into var
(variable, which will be a text node after parsing), -
(operator) , and 1
(number) . However, when there is no space between “-” and “1”, the string will be divided into var
and -1
(number).
Issue Analytics
- State:
- Created 7 years ago
- Comments:14 (8 by maintainers)
Top Results From Across the Web
Trying to split a string into two variables - bash - Stack Overflow
Since that word does not contain a : , read does not split it into two words, and the entire string is assigned...
Read more >$VAR vs ${VAR} and to quote or not to quote
Using quotes around a variable as in rm -- "$VAR1" or rm -- "${VAR}" is a good idea. This makes the contents of...
Read more >Dividing by category of a categorical variable - Statalist
Hello all, Let's say I have a categorical variable, var1, with 3 categories: category count 1 350 2 260.
Read more >How do I calculate a new variable based on values of ... - IBM
The syntax below first generates a sample data file. Then it computes newvar based on what the values of var1 and var2 are....
Read more >How to Combine Two or More Categorical Variables into One ...
COMPUTE newvar = (var1 - 1) * 3 + (var2 - 1) + 1. EXECUTE. If you don't know that: DO IF ANY(var1,...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
The behavior is a bit inconsistent. The problem is, that the
number
definition for most languages begins with the following regex\b-?
. The minus sign can also be a word boundary at the same time and\b
is a zero-length match. This complicates things a bit:word -1
: The zero-length\b
matches between-
and1
because-
is seen as a word boundary. So-
will become an operator and1
will be a number.word-1
: The\b
matches the end ofword
betweend
and-
. This time-
is part of the number.We could make it more consistent and remove all
-?
from thenumber
definitions of all languages. Then it would always be an operator.Ok! Would probably simplify some regexps too 😃