Question: The Ruby Programming Language book describes a ruby integer literal as follows: You write integers using an optional leading sign, an optional base indicator (0
The Ruby Programming Language book describes a ruby integer literal as follows:
You write integers using an optional leading sign, an optional base indicator (0 for octal, 0x for hex, or 0b for binary), followed by a string of digits in the appropriate base. Underscore characters are ignored in the digit string.
Note that the above description is somewhat informal; the letters mentioned in the above description may be either upper or lower case and the underscore characters can only occur strictly within the digit string.
Provide a regular expression which describes ruby integers. Your regex may use whitespace for readability and include #-end-of-line comments for understandability.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
