Github user mattyb149 commented on a diff in the pull request:

    https://github.com/apache/nifi/pull/1296#discussion_r90884772
  
    --- Diff: 
nifi-commons/nifi-expression-language/src/main/java/org/apache/nifi/attribute/expression/language/evaluation/util/NumberParsing.java
 ---
    @@ -21,54 +21,57 @@
     
     public class NumberParsing {
     
    -
         public static enum ParseResultType {
             NOT_NUMBER, WHOLE_NUMBER, DECIMAL;
         }
    -    private static final String Digits     = "(\\p{Digit}+)";
    -
    -    // Double regex according to Oracle documentation: 
http://docs.oracle.com/javase/6/docs/api/java/lang/Double.html#valueOf%28java.lang.String%29
    -    private static final String HexDigits  = "(\\p{XDigit}+)";
    -    // an exponent is 'e' or 'E' followed by an optionally
    -    // signed decimal integer.
    -    private static final String Exp        = "[eE][+-]?"+Digits;
    -    private static final String fpRegex    =
    -            ("[\\x00-\\x20]*"+  // Optional leading "whitespace"
    -                    "[+-]?(" + // Optional sign character
    -                    "NaN|" +           // "NaN" string
    -                    "Infinity|" +      // "Infinity" string
    -
    -                    // A decimal floating-point string representing a 
finite positive
    -                    // number without a leading sign has at most five 
basic pieces:
    -                    // Digits . Digits ExponentPart FloatTypeSuffix
    -                    //
    -                    // Since this method allows integer-only strings as 
input
    -                    // in addition to strings of floating-point literals, 
the
    -                    // two sub-patterns below are simplifications of the 
grammar
    -                    // productions from the Java Language Specification, 
2nd
    -                    // edition, section 3.10.2.
    -
    -                    // Digits ._opt Digits_opt ExponentPart_opt 
FloatTypeSuffix_opt
    -                    "((("+Digits+"(\\.)?("+Digits+"?)("+Exp+")?)|"+
    -
    -                    // . Digits ExponentPart_opt FloatTypeSuffix_opt
    -                    "(\\.("+Digits+")("+Exp+")?)|"+
    -
    -                    // Hexadecimal strings
    -                    "((" +
    -                    // 0[xX] HexDigits ._opt BinaryExponent 
FloatTypeSuffix_opt
    -                    "(0[xX]" + HexDigits + "(\\.)?)|" +
    -
    -                    // 0[xX] HexDigits_opt . HexDigits BinaryExponent 
FloatTypeSuffix_opt
    -                    "(0[xX]" + HexDigits + "?(\\.)" + HexDigits + ")" +
    -
    -                    ")[pP][+-]?" + Digits + "))" +
    -                    "[fFdD]?))" +
    -                    "[\\x00-\\x20]*");// Optional trailing "whitespace"
    -
    -    private static final Pattern DOUBLE_PATTERN = Pattern.compile(fpRegex);
    -
    -    private static final Pattern NUMBER_PATTERN = 
Pattern.compile("-?((\\d+)|(0[xX]" + HexDigits + "))");
    +    private static final String OptionalSign  = "[\\-\\+]?";
    +
    +    private static final String Infinity = "(Infinity)";
    +    private static final String NotANumber = "(NaN)";
    +
    +    // Base 10
    +    private static final String Base10Digits  = "\\d+";
    +    private static final String Base10Decimal  = "\\." + Base10Digits;
    +    private static final String OptionalBase10Decimal  = Base10Decimal + 
"?";
    +
    +    private static final String Base10Exponent      = "[eE]" + 
OptionalSign + Base10Digits;
    +    private static final String OptionalBase10Exponent = "(" + 
Base10Exponent + ")?";
    +
    +    // Hex
    +    private static final String HexIdentifier = "0[xX]";
    +
    +    private static final String HexDigits     = "[0-9A-F]+";
    --- End diff --
    
    Hex digits should accept lowercase values as well


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---

Reply via email to