Skip to content

Commit

Permalink
Fix Reg Ex bug
Browse files Browse the repository at this point in the history
  • Loading branch information
danielb987 committed Jun 10, 2021
1 parent 809eacd commit acd22b7
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
Expand Up @@ -337,6 +337,9 @@ public boolean evaluate() {
case LocalVariable:
otherValue = TypeConversionUtil.convertToString(getConditionalNG().getSymbolTable().getValue(_otherLocalVariable), false);
break;
case RegEx:
// Do nothing
break;
default:
throw new IllegalArgumentException("_compareTo has unknown value: "+_compareTo.name());
}
Expand Down Expand Up @@ -364,11 +367,11 @@ public boolean evaluate() {
break;

case MatchRegex:
result = matchRegex(variableValue, otherValue);
result = matchRegex(variableValue, _regEx);
break;

case NotMatchRegex:
result = !matchRegex(variableValue, otherValue);
result = !matchRegex(variableValue, _regEx);
break;

default:
Expand Down
7 changes: 5 additions & 2 deletions java/src/jmri/jmrit/logixng/expressions/ExpressionMemory.java
Expand Up @@ -366,6 +366,9 @@ public boolean evaluate() {
case LocalVariable:
otherValue = TypeConversionUtil.convertToString(getConditionalNG().getSymbolTable().getValue(_localVariable), false);
break;
case RegEx:
// Do nothing
break;
default:
throw new IllegalArgumentException("_compareTo has unknown value: "+_compareTo.name());
}
Expand Down Expand Up @@ -393,11 +396,11 @@ public boolean evaluate() {
break;

case MatchRegex:
result = matchRegex(memoryValue, otherValue);
result = matchRegex(memoryValue, _regEx);
break;

case NotMatchRegex:
result = !matchRegex(memoryValue, otherValue);
result = !matchRegex(memoryValue, _regEx);
break;

default:
Expand Down

0 comments on commit acd22b7

Please sign in to comment.