Pomsky
Browse docs
    • Introduction
    • Quick reference
    • Quick Start
    • Enable Unicode Support
    • Strings
    • Alternations
    • Repetitions
    • Dots
    • Character Sets
    • Shorthands
    • Anchors
    • Word Boundaries
    • Modifiers
    • Capturing Groups
    • Variables
    • Lookaround
    • Ranges
    • References
    • Inline Regexes
    • Formal grammar
    • Tokens
      • Alternation
      • Boundaries
      • Character Set
      • Dot
      • Groups
      • Inline Regex
      • Lookaround
      • Modifier
      • Negation
      • Number ranges
      • Recursion
      • References
      • Repetition
      • Tests
      • Variables
    • Example: Numbers
    • Example: Passwords
    • Example: Java Identifiers
    • Example: Email Addresses
    • Example: IP addresses
    • Example: Semantic version
    • Comparison with other projects
    • Security
    • Unicode properties

Pomsky

  • Docs
  • Playground
  • Blog
  • Donate


  • GitHub
  • Discord

    • Introduction
    • Quick reference
    • Quick Start
    • Enable Unicode Support
    • Strings
    • Alternations
    • Repetitions
    • Dots
    • Character Sets
    • Shorthands
    • Anchors
    • Word Boundaries
    • Modifiers
    • Capturing Groups
    • Variables
    • Lookaround
    • Ranges
    • References
    • Inline Regexes
    • Formal grammar
    • Tokens
      • Alternation
      • Boundaries
      • Character Set
      • Dot
      • Groups
      • Inline Regex
      • Lookaround
      • Modifier
      • Negation
      • Number ranges
      • Recursion
      • References
      • Repetition
      • Tests
      • Variables
    • Example: Numbers
    • Example: Passwords
    • Example: Java Identifiers
    • Example: Email Addresses
    • Example: IP addresses
    • Example: Semantic version
    • Comparison with other projects
    • Security
    • Unicode properties
    • Introduction
    • Quick reference
    • Quick Start
    • Enable Unicode Support
    • Strings
    • Alternations
    • Repetitions
    • Dots
    • Character Sets
    • Shorthands
    • Anchors
    • Word Boundaries
    • Modifiers
    • Capturing Groups
    • Variables
    • Lookaround
    • Ranges
    • References
    • Inline Regexes
    • Formal grammar
    • Tokens
      • Alternation
      • Boundaries
      • Character Set
      • Dot
      • Groups
      • Inline Regex
      • Lookaround
      • Modifier
      • Negation
      • Number ranges
      • Recursion
      • References
      • Repetition
      • Tests
      • Variables
    • Example: Numbers
    • Example: Passwords
    • Example: Java Identifiers
    • Example: Email Addresses
    • Example: IP addresses
    • Example: Semantic version
    • Comparison with other projects
    • Security
    • Unicode properties
  1. Home
  2. Docs
  3. Examples
  4. Example: Numbers

Example: Numbers

This regular expression matches rational numbers in decimal notation with optional separating commas:

[-+]??\b(?:0|[1-9](?:,??[0-9])*)(?:\.[0-9]+)?\b

Equivalent Pomsky expression:

['-+']?
%
('0' | ['1'-'9'] (','? ['0'-'9'])*)
('.' ['0'-'9']+)?
%
← Variables
Example: Passwords →
  • Powered by Hugo and Doks
  • Contact
  • Code of Conduct