Skip to content

Commit

Permalink
Fixed issue #06330: Regex engine does not accept a leading zero even …
Browse files Browse the repository at this point in the history
…if explicitly specified as acceptable

Dev core problem was that LEMval() was casting [0-9]+ to a number, so would strip off leading zeros.  Now, if has leading zeros, they will be kept.
  • Loading branch information
TMSWhite committed Jul 18, 2012
1 parent 3f2a7dd commit e60f4f7
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions scripts/em_javascript.js
Expand Up @@ -299,6 +299,9 @@ function LEMval(alias)
newval = str.split(',').join('.');
}
if (newval == parseFloat(newval)) {
if (newval.length > 0 && newval[0]==0) {
return newval; // so keep 0 prefixes on numbers
}
return +newval;
}

Expand Down Expand Up @@ -520,6 +523,9 @@ function LEMval(alias)
return value;
}
else {
if (value.length > 0 && value[0]==0) {
return value; // so keep 0 prefixes on numbers
}
return +value; // convert it to numeric return type
}
}
Expand Down

0 comments on commit e60f4f7

Please sign in to comment.