-1

I need to extract only 5 or 6 digit from a string. For example "hi 23456678 is number, also there is a number 92844 and 741653 " I need to extract only the 5 or 6 digit number from string , i tried \d{5,6} but it is giving me result as (23456, 92844, 741653) but my desired outcome should be only 92844 & 741653 , how can i get that. I am using R, please suggest.

Ankit
  • 27
  • 4

1 Answers1

0

You can try this

^[0-9]{5,6}$

{5,6} = between 5 and 6 characters

Hien Nguyen
  • 24,551
  • 7
  • 52
  • 62