0

I have been working on an regular expression which say consists of more than 9 digits ( 12345678910111213 )

With the help of regex \d{9}(?!\d) i am able to find the last 9 digits of the number.

But when the entire number is less than 9 digits how do i take the entire number as pass it. is there any such regular expression.

Wiktor Stribiżew
  • 607,720
  • 39
  • 448
  • 563

1 Answers1

2

\d{1,9}(?!\d) will take as many as possible from the end, up to 9.

tripleee
  • 175,061
  • 34
  • 275
  • 318