Skip to content

[Clarification]: 7.2 numeric-like matchs #54

Description

@aleguy02

Question

The "numeric-like" regex pattern in section 7.2 seems too permissive or perhaps incorrect. For instance, the pattern is

/^-?\d+(?:.\d+)?(?:e[+-]?\d+)?$/i

However, this would mean the first non-capturing group (?:.\d+) uses a dot which captures all, and would capture something like a123. It seems like the intended behavior is to capture decimal portions, thus the non-capturing group should be (?:.\d+)
(note the escaped dot character).

Is this intended and I am missing something or misreading it?

Specification Section

Section 7.2 Quoting Rules for String Values

Source of Confusion

The "numeric-like" regex pattern in section 7.2 seems too permissive or perhaps incorrect. For instance, the pattern is  

/^-?\d+(?:.\d+)?(?:e[+-]?\d+)?$/i

However, this would mean the first non-capturing group (?:.\d+) uses a dot which captures all, and would capture something like a123. It seems like the intended behavior is to capture decimal portions, thus the non-capturing group *should* be (?:\.\d+)
(note the escaped dot character).

Example Case

The pattern in the spec would match 12a34, which is not a number.

Use Case / Context

No response

Reference Implementation Behavior

No response

Checklist

  • I have read the relevant specification sections
  • I have searched for similar questions in existing issues
  • I have checked the examples in the specification

Metadata

Metadata

Assignees

No one assigned

    Labels

    documentationImprovements or additions to documentationquestionFurther information is requested

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions